[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: __iter metamethod?
- From: "steve donovan" <steve.j.donovan@...>
- Date: Tue, 9 Oct 2007 12:05:30 +0200
On 10/9/07, David Given <dg@cowlark.com> wrote:
> The upshot of this is, if you add an __iter metatable entry to allow
> iteration on tables, you also add a nasty ambiguity as to what happens
> if the table has both a __call *and* an __iter. That's not to say it
> can't be done... just that ambiguities like this are best avoided if you
> wish to retain your sanity.
I had forgotten about the __call trick. Sometimes when discussing some
obscure C++ feature Bjarne Stroustrup says 'this conversion was not
permitted because it can result in subtleties'. Well, having been a
C++ programmer for a decade, I think Lua should avoid too many
subtleties ;)
steve d.