lua-users home
lua-l archive

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


On 12/04/2011 11.20, Axel Kittenberger wrote:
Added my emphasis:

manual>  Lua is a case-sensitive language: and is a reserved word, but
manual>  And and AND are two different, valid names. As a convention,
manual>  names *starting with an underscore followed by uppercase
manual>  **LETTERS** (such as _VERSION)* are reserved for internal
manual>  global variables used by Lua.

Lorenzo>  My doubt was whether the underscore is to be considered uppercase,

It doesn't matter if an underscore is "uppercase" or not. An
underscore is not a letter! Case closed :-)



Yes! I know! :-)
Please see my comment on my last reply to Luiz (emphasis added):

"My doubt was whether the underscore is to be considered uppercase, in which case __VERSION would be reserved. If the underscore is not to be considered an uppercase letter, then __VERSION would not be reserved (since in a previous message you clarified reserved names are _all_ uppercase). Therefore I think your clarification was needed (*unless one sticks to the lexicographic meaning of "letters", but there are some computer languages in which the underscore is considered a letter*, hence my doubt). "


Maybe my doubt could sound strange, but see this definition from Java Language Specification, 2nd ed. - section 3.8 "Identifiers" (I've programmed in Java for some years, a while ago):

"The Java letters include uppercase and lowercase ASCII Latin letters A–Z (\u0041–\u005a), and a–z (\u0061–\u007a), and, for historical reasons, the ASCII underscore (_, or \u005f) and dollar sign ($, or \u0024)."


As you see from the excerpt above, computer language definitions are sometimes weird! According to that definition the underscore IS a Java letter (although not a letter in the common sense, of course). You could rightfully say that a "Java letter" is not a "letter", but my doubt was just that Lua could have its "local" meaning for "letter" (say, a sort of implicit "Lua letter").

<flamebait mode=":-)">
Of course you could argue that many years of Java could hurt the mental sanity of a programmer, who will wander in the land of nowhere in a sort of hamletic delirium asking himself "a letter or not a letter" :-)
</flamebait>

Well, now I'm trying to recover. Part of the therapy is assuming increasing doses of Lua :-)

cheers

-- Lorenzo