Date: 2023-05-16 11:02 am (UTC)
simont: A picture of me in 2016 (Default)
From: [personal profile] simont
That's confusing – #3 to #8 inclusive are all in yesterday's post as well!

Also, now I look more closely, yesterday's post doesn't number the links. Some kind of multifaceted confusion?

Date: 2023-05-16 11:23 am (UTC)
simont: A picture of me in 2016 (Default)
From: [personal profile] simont
Ah, the style of Powershell that looks like an actual program! Don't see that every day.

I'm congenitally unable to read any text or code without also proofreading it, so have a bonus drive-by nitpick: "DeletetionTrigger" on line 72 looks like a typo.

Date: 2023-05-16 12:18 pm (UTC)
simont: A picture of me in 2016 (Default)
From: [personal profile] simont
No merge request?

Sorry! I wasn't 100% sure whether there might be code elsewhere that recognised exactly that string and would need to be changed in sync, or some such.

Date: 2023-05-18 08:19 am (UTC)
simont: A picture of me in 2016 (Default)
From: [personal profile] simont
Well, all right, on a typical day I don't see any PS at all. But when I do, it's normally in the "glue code" style: the reason someone was using PS at all was because it has convenient APIs to talk to lots of different classes of thing, and they needed to make those worlds connect together. So it doesn't normally have anything as organised as loops or sensibly named variables; it's just a handful of commands that get stuff from here and send it out to there, the source and destination being things that would otherwise have a hard time talking to each other. If you're really lucky there might be an error handler to abort on failure half way through.

Most of the things I actually know about Powershell came from a book called "Learn Windows PowerShell 3 in a Month of Lunches" (Jeffrey Hicks). That's approaching PS almost exclusively from the angle of "look at all the things Powershell can talk directly to": it's not until chapter 21 (out of 28) that the author even starts talking about saving PS commands in a script file instead of just entering them at the interactive prompt, and even then, the first subheading stresses "Not programming, more like batch files". I think there's one full-length script in the whole book that shows an example of an actual program, with function definitions, try-catch blocks and a while loop. And that's in chapter 26 "Using someone else's script", and none of that stuff is even explained – that was the first hint in the whole book that exceptions are even a thing in Powershell. "Loop" and "exception" don't even appear in its index!

Date: 2023-05-19 10:04 am (UTC)
simont: A picture of me in 2016 (Default)
From: [personal profile] simont
That book definitely struck me as being aimed at the kind of sysadmin-only person who thinks Proper Programming is scary, and trying to sell PS on the basis of all the useful things it can do which aren't programming.

I presume there's some entirely different book out there which teaches the other half of the language!

Date: 2023-05-25 06:29 pm (UTC)
jducoeur: (Default)
From: [personal profile] jducoeur

Yeah -- when I first learned Powershell, I was completely blown away by the idea of being able to actually program the shell, in a respectably real language.

Been many years since I've touched it (I generally use Ammonite these days, to do the same sorts of things in Scala), but at the time it was pretty amazing, and it really surprises me that so few people take real advantage of it.

June 2025

S M T W T F S
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 2021
22232425262728
2930     

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 20th, 2025 09:21 pm
Powered by Dreamwidth Studios