Hacker News new | past | comments | ask | show | jobs | submit login

Reminds me a bit of PowerShell, which also tried the "hey, let's do shell but with object-streams instead of string-strings". Unfortunately PowersHell is less than the sum of its parts - it's very powerfull and expressive, but ungodly warty and inconsistent, mashing up a grab-bag of good ideas from POSIX, DOS, and C# to produce a complete mess.



And then the first time you actually systematically parse and edit a giant JSON blob with it you start going, "Okay, this is a serious improvement."


I use jq to work with JSON in the terminal on macOS. Anyone used both that could compare the two?


With jq I constantly trip up on quoting issues and the query syntax. It takes me forever to write a jq query since I don't use it that often and end up forgetting its DSL.

With PowerShell, JSON can be imported as an object, which is much easier to work with since it uses the same syntax as any other object.

That said, Bash is much faster to start up than PowerShell is, so for low-latency applications like window manager keybindings, I have no choice but to use jq on Bash.


I honestly get annoyed how many platforms say for JSON "yeah, just use the native object querying syntax" while for XML they're all about XPath queries. I have to google how to XPath every time I use it.


PowerShell supports both XPath and native object syntax for reading XML.

Unfortunately, by default, writing XML isn't as straightforward. One has to use XmlDocument methods to construct an XML file. The 'Format-XML' cmdlet in the Pscx extension repository [1] does make it possible to use native object syntax to construct XML files, however.

[1] https://github.com/Pscx/Pscx


> Unfortunately, by default, writing XML isn't as straightforward.

Mhm... It can be very simple - you can construct it as a string with @"...@". Add StringBuilder for some speed if there are truly dynamic XMLs with lots of concats. Its way faster then doing regular C# mumbo jumbo and you can test validity easily with [xml].

I generated tones of XML like that and its also very fast. Don't go by the book, rules are there for mediocre :)


PowerShell - bad syntax and quirky semantics. Looks like on the syntax front they took the bad parts from bash and Perl.


In all fairness, bash is...bash. PowerShell does a really good job of striking a balance between the ease of creating horrible hacked together monstrosities in bash with the ease of terrifyingly converting between data structures in python. It obviously doesn't live up to what it could be, but there's definitely something there.


PowerShell also seems to borrow from Tcl, especially the parameter syntax (Tcl calls them options, *sh calls them arguments) and the script block construct (which is simply a curly-brace-quoted string in Tcl).




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: