Idea: nested &
Opened this issue · 3 comments
akx commented
thing1
&thing2
&doStuffWithThing2()
&&doStuffWithThing1(&somethingFromThing2)
currently compiles to
var x0$, x1$;
x0$ = thing1;
x1$ = x0$.thing2;
x1$.doStuffWithThing2() && doStuffWithThing1(x1$.somethingFromThing2);
though it might be a nice feature to have N+1 ampersands refer to upper &
scopes, ie
var x0$, x1$;
x0$ = thing1;
x1$ = x0$.thing2;
x0$.doStuffWithThing1(x1$.somethingFromThing2);
EDIT: (and &&&, &&&& etc. of course)
vendethiel commented
syntactically conflitcts with &&, no ?
akx commented
&& isn't unary though, so maybe something could be done to allow it in a prefix/standalone context. Either way making this change would break some programs that currently rely on space/newline elision before && (like what happens in the "currently compiled" result there).
&^
, &^^
etc. would also be a (weird?) alternate syntax if &&
, &&&
, etc. aren't a Good Idea.
vendethiel commented
Well, & isn't unary either (and shows some problems, sometimes).