lua-users home
lua-l archive

Re: Lightweight Lua Enumerations

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


On 28-Jun-07, at 12:43 AM, Gavin Kistner wrote:
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.
Why is it different to hardcode a literal string than to hardcode the name of a literal string? Particularly since GOOD is just a shortcut for _G["GOOD"] :)

AltStyle によって変換されたページ (->オリジナル) /