[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: '__iter', yet again!
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 16 Dec 2009 13:23:08 -0200
> > This argument would have some merit if Lua did not already have the
> > "generic for", which is strictly unnecessary as well! My argument
> > is that if you are going to do something at all, you should do it
> > consistently, thoroughly and elegantly. Once you have "generic
> > for" you implicitly have the concept of "objects which can be
> > iterated" and you have to have a way of defining how. Defining how
> > an object should be iterated is conceptually the same as defining
> > how it should be added or concatenated which is done in Lua with
> > metamethods.
> That's not true, we don't have a concept of "objects which can be
> iterated", we have a concept of iterator functions (next), and
> iterator factories (pairs). This is completely different, and you are
> wrongfully introducing object oriented concepts in a language that is
> not OO.
I was about to write this, but you were faster. Thanks,