Mark S. Miller (2013-12-12T19:53:58.000Z)
On Thu, Dec 12, 2013 at 10:37 AM, Kevin Smith <zenparsing at gmail.com> wrote:

>
>>     =>, *=>, !=>
>>     =>, =*>, =!>
>>     =>, *>, !>
>>
>> Which do you hate least?
>>
>
> Hate is such a strong world...  : )
>
> My aesthetic judgement is that "!" is not a good choice because grawl is
> bad for beginners.  And async functions will touch beginners quite heavily
> (I predict).
>

Keep in mind that infix ! is proposed <
http://wiki.ecmascript.org/doku.php?id=strawman:concurrency> for use in ES7
to mean "do this operation eventually", e.g.,

    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));

The use of infix ! here is based on its similar use for concurrent or async
message sending in many process algebra languages as well as Erlang and
Scala. This proposal is far from accepted, and not relevant prior to ES7.
But given that we do adopt infix ! for mean "do this
asynchronously/eventually", it would unduly increase the grawlixness to
adopt an unrelated symbol, such as ~>, for async arrows.



>
>
>>
>> Btw, Kevin, I have read and do not understand your argument about why we
>> would not want generator arrow functions but would want async arrow
>> functions. If we could agree on syntax, I still want both.
>>
>>
> Let me restate first.
>
> At a conceptual level, arrows are mappings.  "x goes to whatever".  That
> is the niche they fill.  That's why they are so beautifully suited to, for
> example, array iteration functions, promise callbacks, and even event
> listeners (which can be considered mappings to void).
>
> Async arrows fit right into that niche, except asynchronously.  "x goes to
> Promise<whatever>".  They will be well-suited to event listeners, in
> particular.  (See my OP for an example.)
>
> Generators, on the other hand, are a way of implementing a sequence.  As
> such, they don't fit into that "arrow" niche.
>

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.



>
> But aren't async functions going to be implemented with generators,
> basically?  Well, yes, but that's just an implementation detail.
>  Generators will probably be used to implement async functions, but they
> are completely different at a conceptual level.
>
> I believe that once we have async functions (and async arrows), the need
> for a lightweight generator syntax will largely evaporate.
>
> Or to put the question on more utilitarian ground:  given async functions
> and async arrows, what use cases are left for generator arrows?
>

Concise synchronous generators.

-- 
    Cheers,
    --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20131212/3934a309/attachment.html>
forbes at lindesay.co.uk (2013-12-16T14:57:30.129Z)
> My aesthetic judgement is that "!" is not a good choice because grawl is
> bad for beginners.

Keep in mind that infix ! is proposed http://wiki.ecmascript.org/doku.php?id=strawman:concurrency for use in ES7 to mean "do this operation eventually", e.g.,

```js
p2 = p1 ! foo(a, b);
```

would be equivalent to


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

which, for local promises, is equivalent to the ES6

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

The use of infix ! here is based on its similar use for concurrent or async
message sending in many process algebra languages as well as Erlang and
Scala. This proposal is far from accepted, and not relevant prior to ES7.
But given that we do adopt infix ! for mean "do this
asynchronously/eventually", it would unduly increase the grawlixness to
adopt an unrelated symbol, such as ~>, for async arrows.

> Generators, on the other hand, are a way of implementing a sequence.  As
> such, they don't fit into that "arrow" niche.

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

Where

```js
x => t
```

implements the mapping type X -> T, the corresponding

```js
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 `T`s.

> given async functions and async arrows, what use cases are left for generator arrows?

Concise synchronous generators.