lua-users home
lua-l archive

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


On Saturday 01 January 2011 15:30:47 kevin beckford wrote:
> > To be honest though, I'm not even sure those advocating "fixing" what
> > isn't broken here aren't just a (very) vocal minority.
> 
> I would request that the language not be changed.  '#' certainly is an
> odd concept to the newcomer,  but if it behaves regularly, then it is
> an idiomatic part and will be learned.   The goal in any language is
> to use it idiomatically, after all.

I'm always a big fan of not changing something in a language unless it's 
REALLY necessary, given that it will cause old code to break.

After seeing the huge discussion of #, I personally wouldn't be caught dead 
using it. First of all, pairs() and next() can be used to iterate through any 
table, removing one of the main uses of #. If I must know the number of items, 
I can always have a "items" key with the count for a value. If I must know the 
highest integer subscript, I can always keep it in a "hi" key. If making a 
ring buffer, I can always use a "lo" key. I don't know, maybe there's a 
performance penalty for these things, but using a table of key->value pairs 
makes it very easy to keep track of things like this.

SteveT

Steve Litt
Recession Relief Package
http://www.recession-relief.US
Twitter: http://www.twitter.com/stevelitt