Spawn proposal strawman
Brendan Eich
brendan at mozilla.com
Sat May 9 14:50:22 PDT 2009
On May 9, 2009, at 2:32 PM, David-Sarah Hopwood wrote:
> I would mildly prefer to use an S-expression-style AST, like this:
>
> ["||",
> ["||",
> ["Id", "X"],
> ["Id", "Y"]],
> ["Id", "Z"]]
>
> which is more concise, does not lose any useful information, and
> is easier to remember. This is the same style as used in JsonML
> (www.jsonml.org).
Not bad. I will give it a try in the prototype I've started. Thanks
for the pointer.
> It so happens that this is *semantically* equivalent to "a || (b ||
> c)",
> but that is not an equivalence of abstract syntax.
I know, that's my point. The connectives can be parsed and evaluated
either way, but the short-circuiting seems to favor right
associativity, on one hand.
On the other hand, I'm defying a long tradition here. The precedent
going back to C (K&R before ANSI got in the loop; ignore Algol and
BCPL precedents ;-) uses left associativity, and ES1 followed suit.
So this is not a big deal, and it would be quixotic of me to make too
much of it :-). I wanted to raise it as a potential issue. It's a
practical issue in SpiderMonkey since we do right-associate || and &&
in the internal syntax tree.
/be
More information about the es-discuss
mailing list