What is really the meaningful difference between this and an s-expression language? “” and {}, really. It’s a different way to serialize the same thing.
So I’d argue a lot of the criticism is valid.
We do, as an industry, tend to run in circles.
Turing completeness.
>So I’d argue a lot of the criticism is valid.
I'd argue they should have paid more attention in college. This is far from a superficial difference.
You might as well call HTML a programming language. Seriously.
>Turing completeness.
S-expressions in and of themselves are obviously not Turing complete. This language could easily have been encoded in S-expressions, just like Lisp can be encoded as JSON. (Like, trivially, as lists with quoted strings instead of atoms, or using whatever object-based syntax.)
There's thousands of ways this could have been encoded. Why that one specifically?
I had only a vague idea of what an AST was, but the highest upvoted comment was clearly saying: This is dumb, we have dedicated formats for turning text into ASTs. ( i.e. a programming language ).
In the past decade+? i have learned what an AST is and have now twice, in a professional setting, prevented an engineer from re-inventing this very concept.
If i had to choose if hackernews is a place where smug snark comments crack down on re-inventing known concepts or a happy place where every idea is a good one i will choose the former.
And once every blue moon we get to laugh and look back at snarky comments such as this: https://news.ycombinator.com/item?id=9224
This is one of the few projects addressing the latter problem space.
JSON is a serialization format. So say you have an in-memory AST, and you want to serialize it: why not use JSON?
If you don't want or need to serialize it, then of course don't use JSON. I can make up plenty of other reasons not to, but they're variations on some other format being better for the application, not JSON being inadequate in any way. I'd probably use JSON myself, and I don't care for it much.
Or are we talking about building up an AST in JSON directly rather than taking some parser output and serializing it? Ok that's... not an AST then, it's a programming language with JSON compatible syntax, and yes I would try and prevent that from getting implemented as well.
Lispers are always pointing out how the parenthesis-and-whitespace notation is just incidental; how s-expressions are really something deeper that isn't bound to a specific syntax, and how this is a strength. The OP is a demonstration of that strength.
level = new Expression(['map', ['char', ['tail', 2], 0], {'=': 1, '-': 2}])
body = new Expression(['parse', ['trim', ['body']]])
name = new Expression(['replace', ['trim', ['body', 1]], /[ \t\r\n]+/, ' '])
target = new Expression(['first', ['body', 2], ['body', 3], ''])
The arg to `new Expression` is a Javascript object (i.e. can be sourced from JSON). The first element in each nested array is a function name/operator. It was absolutely trivial to implement. All the functions are implemented in a few lines of code within cases of a switch statement, and nested expressions are handled recursively.For me this is just a temporary throwaway solution while I work on other more critical stuff first. I will replace it with an s-expression based DSL later. Like JSONLogic, it won't be Turing complete.
It just seems to me that JSONLogic is making a huge deal for what's really just a small reusable library.
> JsonLogic has no setters, no loops, no functions or gotos. One rule leads to one decision, with no side effects and deterministic computation time.
It's like eBPF for applications!
The fact that it use JSON instead of your favorite serialization format isn't the thing to be talking about.
0. https://stackoverflow.com/questions/1423081/json-left-out-in...
Citation? I don’t know many people who would call Brendan Eich anti-intellectual for instance.