I believe this would be a reasonable concise synchronous generator someone 
could write:

```js
const concat = (a, b) =*> { yield* a; yield* b; }
```
________________________________
From: Kevin Smith<mailto:[email protected]>
Sent: ‎12/‎12/‎2013 15:17
To: Mark S. Miller<mailto:[email protected]>
Cc: Brendan Eich<mailto:[email protected]>; 
es-discuss<mailto:[email protected]>
Subject: Re: Reserving await within Arrow Functions


    p2 = p1 ! foo(a, b);

would be equivalent to

    p2 = Promise.cast(p1).send("foo", a, b);

which, for local promises, is equivalent to the ES6

    p2 = Promise.cast(p1).then(r => r.foo(a, b));

Yes, but "!" isn't agreed upon.  By that time, we might be over our 
CoffeeScript-inspiration long enough to consider thin arrows.  After all, thin 
arrows are used for a different kind of indirection in C.  Maybe...


Actually, they do. Thanks to Domenic for triggering the following thought:

Where
    x => t
implements the mapping type X -> T, the corresponding
    x =*> t
implements the mapping type X -> T*, where the "*" here reads like the kleene 
(or regexp) *, i.e., this function maps from an X to zero or more Ts.


Exactly.  That's my point, essentially.  The design niche for arrows is 
expressing simple surjections (with side-effects of course), not one-to-many 
relationships.


Concise synchronous generators.


Restating the feature isn't exactly demonstrating a use case : )  Is there a 
concrete example which would give us some idea of the benefit of arrow 
generators?

It's difficult because we don't have much data yet.  But that lack of data is 
another argument for reserving await, I think.

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to