lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, Jun 07, 2002 at 09:48:32PM +0200, Edgar Toernig wrote:
> The "coroutines" in Lua5 just implement regular subroutines
> with preserved state.  But the symmetry of "calling each other"
> does not work.  In fact, something like a "yield" is a
> higher level concept that has nothing to do with basic
> coroutines but seems to be the only way in Lua5's coroutines
> to leave one.

They could very easily be used to implement Sather-style iterators,
which are restricted forms of coroutines.

Perhaps it would be better to name them something like that?
(then again, the name iterator isn't really sufficiently general, I
suppose)

I personally don't have any problem with the name (as that's the
terminology used around sather and clu), but I don't have a problem with
the name changing, either.  But having the feature is great!
It allows easy creation of safe iterators in lua, so various horrible
things like fencepost errors can be more easily avoided.

Cheers.

-- 
  -/ 
 |/|  Julian Squires <tek@wiw.org>
 /-