Add Computation Expressions (from f#) to javascript

To avoid 'breaking the web' I think async wouldn't be allowed as a custom CE builder otherwise it would change the behaviour of existing code.

Oh I didn't know that async could be used as a variable name, then indeed, we shouldn't allow overriding that :(

Also some additional syntax that signals when a CE is being used would likely be desired to avoid limiting future JS proposals too much. For example a proposal to add Map or Set literals

For this specific instance, Map or Set could actually be defined from a CE using the yield functionality (that's what the seq CE in f# does. You could get something very similar depending on actual concrete syntax (e.g. fsharp allows to drop the yield keyword in some circumstances)

But in general, I agree, I guess we could use it like cancellableAsync function () {} for the function syntax and following either do cancellableAsync or cancellableAsync do for block-syntax (similar to what Async variant ยท Issue #4 ยท tc39/proposal-do-expressions ยท GitHub is planning to do for async)?

Then we wouldn't "use" too much possible syntax.

A set could then be defined as

let s = do set { yield 1; yield 2; yield 3; };
// If yield ommission is supported
let s2 = do set { 1; 2; 3; };

If this was how we would define sets and maps, we have the advantage that userland could easily add other "literals" because it's just a matter of bringing in a certain value in scope and using that as a CE