lua-users home
lua-l archive

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


On Mon, May 24, 2010 at 3:09 PM, Jonathan Castello <twisolar@gmail.com> wrote:
> Anyways, maybe I was a bit hasty with "abolishing" the numeric-for.
> Clearly there's more to consider than syntax; I just very much like
> the idea of keeping iteration under the same roof, so to speak.
> Besides, if __iter works out, anyone can make "for i in 10, 1, -1 do"
> work just by setting the number-type's metatable.

Although to be honest, I'd like someone to clear this up for me. What
difference is it to the VM if it handles numbers as a special case? I
don't know that much about the internals, but it seems to me that both
the numeric and generic for have variables on the left, and parameters
on the right; is it that difficult to keep the same bytecodes
internally, and map to the internal numeric-for representation if the
target is a number without an __iter?

~Jonathan