Re: Lightweight Lua Enumerations
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Lightweight Lua Enumerations
- From: Rici Lake <lua@...>
- Date: 2007年6月28日 00:52:18 -0500
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"] :)