6 ms·
A lot of shallow, smug snark coming into the comments section from people who know what s-expressions are and I guess want to brag about that for some reason. S
by joshlemer 5y ago
A lot of shallow, smug snark coming into the comments section from people who know what s-expressions are and I guess want to brag about that for some reason. S expressions are cool but that's just _a syntax_, there are other possible syntaxes for expressions, and it's perfectly fine that somebody chooses to embed a language in JSON rather than s-expressions. Everyone suggesting to use Scheme or Clojure or Common Lisp and dropping the meme-quote that everyone eventually reimplements Lisp are missing the fact that this language is designed to be evaluated deterministically, so it does not support looping or functions and is Turing-Incomplete, unlike Clojure/Scheme/CommonLisp.
- yongjik 5y agoI think comparison to s-expressions are a red herring. In Lisp, I guess, s-expressions are an integral part of how you code. As a piece of general code, it can be great or terrible. This "JsonLogic" thing is explicitly intended to be "logic-inside-configuration" because (I hope) nobody's writing program with JsonLogic. Unfortunately, logic inside configuration is almost always a bad idea. (It doesn't matter whether you're using json or xml or s-expressions.)
- brundolf 5y agoDon't most of the problems with "logic-inside-configuration" come from turing-completeness? This spec has neither control-flow nor reusable functions (recursion); it's nothing but simple expressions. That seems safe to me.
- whalesalad 5y agoUltimately it’s all data. The difference between this and lisp is just a bunch of extra characters and noise in the stream. 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.
- sebmellen 5y agoThe most important difference to me is that this is usable within already extant JSON Schemas that can be patched up or added to.
- pydry 5y ago>What is really the meaningful difference between this and an s-expression language? 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.
- rvense 5y ago>>What is really the meaningful difference between this and an s-expression language? >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.)
- pydry 5y agoWell, the most famous example most definitely is. There's thousands of ways this could have been encoded. Why that one specifically?
- remram 5y agoCorrect me if I'm wrong, but not every s-expression language is Turing-complete, you need the ability to define functions which is not a given. This project doesn't have functions (or loops) seemingly on purpose (and their addition would make this weird language just as Turing-complete).
- deleted 5y ago[deleted]
- deleted 5y ago
- tgbugs 5y agoThey may be shallow comments, but they have a point. JSON is fundamentally unsuitable for anything numerical for a variety of reasons [0]. Thus, it actually can't ever even get to the point of being a suitable replacement for expressions in the languages you listed. Most web tech has insidious anti-intellectual designed baked in, and the end result is that people end up rolling their own mutually incompatible bespoke solutions to problems that were solved before the web was even a glimmer in the eyes of the advertising industry. 0. https://stackoverflow.com/questions/1423081/json-left-out-infinity-and-nan-json-status-in-ecmascript https://stackoverflow.com/questions/1423081/json-left-out-in...
- shawnz 5y agoWith s-expressions where that functionality is simply not provided as part of the underlying syntax at all, then every solution is a mutually incompatible bespoke solution. You could just use all string values in JSON and get the same effect.
- ironmagma 5y ago> Most web tech has insidious anti-intellectual designed baked in Citation? I don’t know many people who would call Brendan Eich anti-intellectual for instance.
- eevilspock 5y agoHere's the thing: I implemented exactly this for a side project where I needed users to be able to express simple logic for custom data handling rules. Here are some examples: 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.
- karmakaze 5y agoI was all set to not like this. Without even getting into the depths of it I can tell I misjudged it from the name. > 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.