(Almost) everything is expression
Mark S. Miller
erights at google.com
Fri Nov 11 07:33:00 PST 2011
Insist on enclosing parens, since
"(" introductory-token
is not otherwise legal
> let a = (switch (foo) {
> case 10: 100;
> default: 200;
> });
>
> 2. If-expression:
>
> let a = (if (foo) {
> print('a is foo');
> foo;
> } else {
> // do some longer stuff
> });
>
>
> 3. Try-expressions:
>
> let a = (try {
> // do dangerous stuff
> "ok value";
> } catch (e) {
> "default value";
> });
>
>
> let a = ({
> print('doing stuff');
> 100;
> });
>
Even the last is now easily unambiguous.
--
Cheers,
--MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111111/490de60f/attachment.html>
More information about the es-discuss
mailing list