Improved syntax for observable mapping and subscribing

Thomas Grainger tagrain at gmail.com
Fri Mar 23 15:06:00 UTC 2018


You can convert an observable into an async iterator. You have to choose
between discarding or buffering uniterated items

On 23 Mar 2018 14:39, "Bob Myers" <rtm at gol.com> wrote:

> Could someone jog my memory about proposals for better syntax for
> observable mapping and subscribing, if any?
>
> I'm getting really tired of writing
>
> ```
> foo$.pipe(map(bar => mapper(bar)))
> ```
>
> I would much prefer to write something along the lines of
>
> ```
> stream function fooMapper(foo$) {
>   while async (const bar = foo$()) {
>     emit mapper(bar);
>   }
> }
> ```
>
> Yes, I'm aware of all the potential issues here and this is just an
> example, not an actual syntax proposal. I'm just wondering about any prior
> art.
>
> Bob
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180323/7643f405/attachment.html>


More information about the es-discuss mailing list