[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Lightweight Lua Enumerations
- From: "Jerome Vuarand" <jerome.vuarand@...>
- Date: Thu, 28 Jun 2007 10:20:13 -0400
Gavin Kistner wrote:
> On Jun 27, 2007, at 6:06 PM, Rici Lake wrote:
>> On 27-Jun-07, at 6:09 PM, Gavin Kistner wrote:
>>> What do _you_ do when you need a simple, lightweight way to create
>>> some unique values?
>>
>> I use simple lower case strings, unless a better solution occurs to
>> me. In your example, I would might use "good", "sin", "cos" and
>> "sin".
>
> Would you do:
> GOOD = "good"
> SIN = "sin"
> COS = "cos"
> and use the 'constant' variable for assignments and comparisons? I
> realize the foolishness of that, but (even without a hack to holler
> if I read an undefined global) it somehow feels cleaner than just
> hardcoding the same literal strings in many places in the code.
I personally use simple quotes for constants and double quotes for all
other "normal" strings. It makes the code *look* cleaner :-)