One-shot Delimited Continuations with Effect Handlers

Sebastian Markbåge sebastian at calyptus.eu
Wed Mar 16 01:14:09 UTC 2016


It's possible that this pattern matching feature can be decoupled into a
separate proposal though. You'd need a way to call an iterator but only
receive specific matches and reyield the rest.

On Tue, Mar 15, 2016 at 6:05 PM, Sebastian Markbåge <sebastian at calyptus.eu>
wrote:

>
> Perhaps if there was a way to wrap any arbitrary expression with a
>> generator that captured any yielded values and allowed resumption by
>> calling .next(), then you could accomplish this without inventing new
>> try-catch syntax?
>>
>
> Yea, except you need to be able to nest them inside each other as well.
>
> If a generator captured any yielded values, then it would be yielded at
> the inner most caller.
>
> You could handle this the way JavaScript does exception handling by
> "rethrowing" errors it didn't handle. I.e. if you see a yield that you
> don't recognize you would re-yield it.
>
> In my use case I can have many nested handlers and I want to handle a
> particular type at the top of the stack. If you have to conditionally
> "reyield" all the way up there, you miss out on potential important
> optimizations.
>
> This is related to "enums" and "pattern matching" too. The current pattern
> matching proposal also doesn't have any optimizations either.
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160315/07f08ce1/attachment-0001.html>


More information about the es-discuss mailing list