lua-users home
lua-l archive

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


 ----- Original Message -----
From: steve donovan
Date: 5/22/2010 7:57 AM
On Sat, May 22, 2010 at 3:50 PM, Quae Quack<quae@daurnimator.com>  wrote:
or in the rare situations you do actually need the ipairs function:
provide/write it.
Ah, but there are thousands of lines of Lua code using ipairs; why break them?
I concur.

I'm well aware of the performance issue with ipairs, as I find myself often rewrite nice looking ipairs() code into "for index = 1, #t do local value = t[index]". I've been meaning to get into the Lua VM and write a couple custom opcodes to allow ipairs to work at full speed.

otherwise how often are you providing literals in your fors?

PS I have mixed feelings on this one. On the one hand, if I was
otherwise how often are you providing literals in your fors?

PS I have mixed feelings on this one. On the one hand, if I was
introducing a person to the language, then having both pairs and
ipairs to explain would be tricky - whereas everyone gets numeric for.
   On the other hand, 'active' deprecation leaves little patches of Lua
code out there that tend to break nastily - like 'for k,v in t do'
which I was very fond of at the time.
I am still fond of 'for k,v in t do'. I was very sad to see it go. It was simple. Lua is supposed to be simple, but ipairs/pairs complicated it.

Josh