[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: Lightweight Lua Enumerations
- From: "Gavin Kistner" <gavin.kistner@...>
- Date: Thu, 28 Jun 2007 09:23:02 -0600
From: Rici Lake
Sent: Wednesday, June 27, 2007 11:52 PM
> 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"] :)
It's not, and I grok the stringness of variable names. It just somehow
/feels/ cleaner :)
(Except, as parenthetically noted above, that I could have _G holler on
__index and it would tell me about a typo that wouldn't be so readily
identifiable if the typo was in a string literal. But...I never ever do
Thanks for your input.