[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: digit strings as table indexes
- From: Jimmie Houchin <jhouchin@...>
- Date: Thu, 25 Jan 2007 10:22:09 -0600
Okay, I learned that '000' is not a valid name in Lua.
But for whatever reason it is accepted successfully as a table index.
I don't if that is something I can depend on or not.
If I don't care about losing the syntactic sugar of t.000 for access,
are there other inherent problems with using digit strings to index tables?
I don't have a lot of programming experience, so I am looking for some
wisdom from those who are further down this journey.
So many things are identified by numbers, products, people, books, etc.
Numbers as unique identifiers are common. And especially since nothing
starting with a digit is a valid name, regardless of subsequent
alphanumeric characters. That invalidates lots of ids for objects.
But I don't know if I'll run into problems continuing down that road.
I don't want to build a huge people database indexing them by their SSN
(U.S. Social Security Number) and then find I am using poor practices.
Would it be better, even if seemingly uglier (to me) to use
'ssn123-45-6789' instead of simply '123-45-6789'
which would make the digit string into a legitimate Lua name.
Any wisdom, knowledge and understanding greatly appreciated.
Thanks.
Jimmie