coco
coco copied to clipboard
Idea: nested &
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)
syntactically conflitcts with &&, no ?
&& 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.
Well, & isn't unary either (and shows some problems, sometimes).