lua-users home
lua-l archive

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


On Wed, May 26, 2010 at 2:52 PM, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
> Few (if any) benchmarks use pairs; many use numerical loops ;)

It's easy to see why, and a wise programmer knows the cost of every
construct.  But I don't see why we can't keep a little bit of
redundancy, if it does not cost the language much, so certain common
patterns can continue to be expressed neatly.  Premature optimization
may not be the root of all evil, but it does lead to awkward code ;)

For instance,

for i,v in ipairs(t) do
  if v == '' then table.remove(t,i) end
end

is rather less clear without ipairs...

steve d.