On Wed, 2009-09-16 at 13:34 +1000, Magentus wrote: > On Sun, 13 Sep 2009 17:40:33 +0200, > Jürg Billeter <j...@bitron.ch> 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. > > Can I ask what probably should be an obvious answer... Why is it > 'yield return'. What else can 'yield' be followed by?
`yield return' statements are used to return values from a generator/iterator to the caller (of Iterator.next). This is not implemented yet in Vala but it's planned for a future version. `yield' expressions, on the other hand, are used to call async methods from within an other async method without blocking the original caller. They do not return a value to the original caller. This is implemented in Vala master. If these definitions sound too complicated, I'll try to come up with some good async examples and will blog them. > > I can't see a reference to documentation on the syntax and usage of > 'yield' anywhere... But I'm guessing everyone else has? `yield' expressions only have been implemented (correctly) for a few days, we'll have to update the documentation. Jürg _______________________________________________ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list