Do-Expressions Proposal Stalled?

Michael Rosefield rosyatrandom at
Thu Jan 18 12:39:00 UTC 2018

Ha, yes, seems we're on the same page here. I agree that `do` is necessary
to distinguish between object literals (really makes you wish that standard
keyboards had access to more symbols so that we could avoid all this
overloading of meaning), but I'd love to know what the issues with using
these blocks as expressions are. Perhaps we could use `do` in front of any
statement to make it treatable as an expression; we could have pure `do`,
`do while` (as distinguished from `do-while`...), `do switch`, `do for`....

On Thu, 18 Jan 2018 at 12:33 T.J. Crowder <tj.crowder at>

> On Thu, Jan 18, 2018 at 12:21 PM, Michael Rosefield <
> rosyatrandom at> 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: <>

More information about the es-discuss mailing list