Do-Expressions Proposal Stalled?

T.J. Crowder tj.crowder at farsightsoftware.com
Thu Jan 18 12:32:52 UTC 2018


On Thu, Jan 18, 2018 at 12:21 PM, Michael Rosefield <rosyatrandom at gmail.com>
wrote:
>
> Just to stick my uninformed oar into this, I notice what
> `do-while` statements *already* return a value in the exact way
> as the proposal.

FYI, it's not just `do-while`: Any statement (including the block
statement) "returns" the value of the last expression evaluated within it.
But as you indicated, that's only available to the JavaScript engine itself
(and REPLs that integrate with it).

The purpose of `do` is to expose that to code. I'm sure Dave Herman looked
at the ramifications of allowing statements as expressions in the general
case and found issues (I'd be shocked if there weren't really quite major
issues with doing that). Separately, without the leading `do` there's no
way, syntactically, to use a block statement as the do expression (since in
an expression context, the `{` meant to introduce the block parses as the
beginning of an object initializer).

-- T.J. Crowder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180118/bf61cab3/attachment.html>


More information about the es-discuss mailing list