On Sun, Sep 13, 2009 at 17:40:33 +0200, Jürg Billeter wrote:
> This should be `yield return i;'. We do not use/need `yield return' for
> async methods, and I'm planning to add support for `yield return' for
> generators in Vala the same way as it's used in C#. I don't see a
> conflict here.

Ok. You are right. It's a bit ugly syntax from C# but that does not matter.

> > This has nothing to do with asynchronous at all.
> > 
> > I understand this is would be complicated to implement, but please at least
> > don't use any of that syntax in an incompatible way.
> > 
> > Virtual machines actually have it pretty easy to implement. They just stash
> > away the running function state and than resume it. Vala can't easily do
> > that, but I see two options for it:
> > 
> >  - Generate the function in a special way so it is restartable. This would
> >    mean to generate an anonymous class. All arguments and variables would be
> >    converted to members of that class. Plus one extra member would remember
> >    which point the function last returned at. Than if the function contained
> >    no block-local variables, it should be possible to wrap it in a big case
> >    (similar to what Duff's device uses) to jump to the correct point to
> >    continue.
> 
> That's roughly what we already do for async methods, and the
> implementation will be very similar for generators.

I see now. Nice, indeed.

-- 
                                                 Jan 'Bulb' Hudec <[email protected]>
_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to