Hacker News new | ask | show | jobs
by enriquto 709 days ago
> I like the syntax to send typed values from the terminal:

Incidentally, this syntax shows a notation that is clearly superior to json (at least for non-nested stuff). If all you need is this, you'd be better off by avoiding json altogether.

[Rant: if json is so unergonomic that people keep inventing alternatives like this syntax and stuff like "gron" to de-jsonise their lives, maybe using json was always a bad idea, after all... I guess in a decade everybody will look at json with the same disdain as we do XML today.]

1 comments

> shows a notation that is clearly superior to json

I don’t see that at all? Why is `n:number=1` superior to `{n:1}`? If anything, CLI commands are awful for anything other than strings.

But strings are often the most common case (or even, the only case that is needed). And they need much less punctuation. Compare:

    a=1 b=2 c=3
with

   {"a"="1", "b"="2", "c"="3"}
the json version needs 19 punctuation characters just to define three variables, against the bash version that only has 3. Which one would you prefer to type with your keyboard?
Depends on the shell. The following parses as a number in Murex:

    %{n:1}
https://murex.rocks/parser/create-object.html

I’m sure you can do similar things in other modern shells too. So the real problem is that people are stuck on the constraints of 1970s command lines.