samuelgoto / proposal-block-params

A syntactical simplification in JS to enable DSLs
204 stars 8 forks source link

Async body? #14

Open Ltrlg opened 6 years ago

Ltrlg commented 6 years ago

Reading the “testing” example, I remembered that I often need await in tests and developers will probably want to be able to use it in many of the presented use cases (of the first section in the readme, at least lock/foreach/using would obviously benefit of await).

Support or no support should be at least explicit in the readme.

samuelgoto commented 6 years ago

In the current formulation, async bodies wouldn't be supported, purely as a sequencing strategy than necessarily a disagreement. Can you give me an idea of what kind of use cases this would enable?

I ran into this, which may or may not be related:

https://github.com/inexorabletash/ecmascript-async-do-expressions

samuelgoto commented 6 years ago

Was just reading @isiahmeadows's alternative exploration and ran into some very interesting syntax space for async bodies. Here is what he has:

@foo(...) async do { ... } makes the block async, like an async function

Not sure yep what to think of, but food for thought (also, waned to connect the dots here between you two).