
J-expressions (2012) - galfarragem
http://sriku.org/blog/2012/04/15/j-expressions/
======
nine_k
See
[https://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule](https://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule)

That 'half of Common Lisp' thing keeps popping everywhere, unless explicitly
planned.

~~~
duaneb
Ironically, I think common lisp is itself 'an ad hoc, informally-specified,
bug-ridden, slow implementation of half of Common Lisp'.

~~~
AnimalMuppet
That is in fact Morris's Corollary to Greenspun's Tenth Rule.

------
angersock
It's JSON as AST!

Two things that bother me:

First, the insistence on changing the way keys are written so as to break
compatibility with JSON.

Second, the assumption on the ordering of keys in an object--it's my
understanding that the standard _does not_ require the order of keys to be
preserved. Even if everyone does it, that's not a good thing to force on
people if they are otherwise following the official standard.

~~~
thyrsus
Without assuming order, you'd be forced to use something that explicitly
provided order, such as an array. I suppose you could use

    
    
        { "jexpr":
            [ "function",
              "and",
              "its",
              [ "arguments",
                "may be",
                "arbitrarily complex"] ] }

~~~
emeraldd
Or better yet, how about something like:

    
    
       [ "jexpr",
          [ "function",
                "arg1",
                "arg2",
                ["Complex", "argument"]]]
    

Which wouldn't break the spec either. It also happens to pretty closely match
an S-Expression.

~~~
dugmartin
If you made simple strings atoms and a "'triple quoted'" strings (or
substrings) a string then you could implement a simple Lisp in it by replacing
the parse() function in [https://www.hackerschool.com/blog/21-little-lisp-
interpreter](https://www.hackerschool.com/blog/21-little-lisp-interpreter).

Might be an interesting way to expose an api.

------
netcraft
getting a 404 on the linked article about dsl's and linked expressions.

Edit: I believe this is the proper link:
[http://sriku.org/blog/2012/04/14/creating-dsls-in-
javascript...](http://sriku.org/blog/2012/04/14/creating-dsls-in-javascript-
using-j-expressions/)

Definitely interesting though - json as a DSL with implementation in many
languages could be useful for lots of message bus applications.

~~~
galfarragem
Yep, that's the proper link.

Disclaimer: I made the post in HN but (unfortunately) I'm not the blog author.

------
davexunit
Just use s-expressions, already.

~~~
oconnore
Especially if you're not even using real JSON.

An actual JSON compliant expression spec would be somewhat interesting, to
capitalize on existing parsers and tooling. It would be even more interesting
if it had a 1-1 mapping to scheme or some other Lisp. This accomplishes none
of that.

------
cbsmith
The value of mobile code isn't exactly a new thing. I didn't even think it was
a new thing for the JavaScript world.

