Re: Conditional await, anyone?

2019-10-09 Thread Tab Atkins Jr.
On Wed, Oct 9, 2019 at 12:08 AM Andrea Giammarchi wrote: > I don't know why this went in a completely unrelated direction so ... I'll > try to explain again what is `await?` about. Nah, we got it. Our complaint was still about the semantics. > ```js > const value = await? callback(); > > // as

Re: Conditional await, anyone?

2019-10-09 Thread Herby Vojčík
Hi! First, experiences of this guy https://medium.com/@bluepnume/intentionally-unleashing-zalgo-with-promises-ab3f63ead2fd seem to refute the problematicity of zalgo. Second, I actually have the use case of this pattern (though actually it's not a use case for a new syntax). In Amber

Re: Conditional await, anyone?

2019-10-09 Thread Isiah Meadows
I had a similar example in real-world code, but it was just to merge sync and async into the same code path. I handled it by using generators and basically running them myself: https://github.com/isiahmeadows/mithril-node-render/blob/v2/index.js#L195-L206 In either case, I'm not sure it's worth

Re: Conditional await, anyone?

2019-10-09 Thread Andrea Giammarchi
I don't know why this went in a completely unrelated direction so ... I'll try to explain again what is `await?` about. My first two examples show a relevant performance difference between the async code and the sync one. The async code though, has zero reasons to be async and so much slower.