title: Put the knife down and take a green herb, dude. |
descrip: One feller's views on the state of everyday computer science & its application (and now, OTHER STUFF) who isn't rich enough to shell out for www.myfreakinfirst-andlast-name.com Using 89% of the same design the blog had in 2001. |
FOR ENTERTAINMENT PURPOSES ONLY!!!
Back-up your data and, when you bike, always wear white. As an Amazon Associate, I earn from qualifying purchases. Affiliate links in green. |
|
x
MarkUpDown is the best Markdown editor for professionals on Windows 10. It includes two-pane live preview, in-app uploads to imgur for image hosting, and MultiMarkdown table support. Features you won't find anywhere else include...
You've wasted more than $15 of your time looking for a great Markdown editor. Stop looking. MarkUpDown is the app you're looking for. Learn more or head over to the 'Store now! |
|
Tuesday, January 06, 2015 | |
Coming from JavaScript, it feels like adding a function to a hashtable in PowerShell shouldn't be that complicated. Took a bit of googling, but it's not. For PS 3+...
Create hashtable. Cast to PSCustomObject (this is the same as saying You can kinda tell it's [C#-ish] .NET because you're into the Want a function with params? Can do.
That adds two methods, the second with params. Calling the function is also painfully .NET-ese, right back to the parens that your first few weeks of PowerShelling taught you to avoid (original, pre-fiddled sauce):
I really dislike how that paradigm shift (from PowerShell modules to unabashedly .NET functions) operates, but I guess the point is that a Verb-Description is never going to belong to an object. They are tied to no specific noun. Yet PowerShell still feels a little like a kludge that too often gives up and dumps its problems directly into .NET. That's good, since I'm a .NET programmer, but bad in that PowerShell feels imcomplete and kludgey, and its culture (I think even the new-as-of-PS 3 [PSCustomObject] cast is kludgey, and that's straight from the Scripting Guy as the preferred method of doing this) is wrapping itself around these sorts of kludges instead of pushing forward PS development and best practices. Maybe dumping into .NET is good. Idk. But it's sure grafty, grafty like the Tree of 40 Fruit. Thanks to these links:
Labels: OO, powershell posted by ruffin at 1/06/2015 01:54:00 PM |
|
| |
All posts can be accessed here: Just the last year o' posts: |
||||||||||||||||||||||
|