[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: The meaning of 'sugar' [Forked from Re: Why do we have ipairs?]
- From: Alex Szpakowski <aszpakowski@...>
- Date: Fri, 13 Jun 2014 00:42:05 -0700 (PDT)
Ross Bencina wrote
> On 13/06/2014 4:13 PM, Thomas Jericke wrote:
>>> I'll leave it to others to determine whether using string literals in
>>> an interface is ever good style.
>>>
>>> Ross.
>>>
>>>
>>
>> [...]
>>
>
> You're intentionally twisting my words.
>
> It's one thing to be able to use a string literal, quite enough to
> require its use in an interface.
>
> We're not talking about module or function names here, we're talking
> about constants that are usually integers.
>
> Ross.
Lua's own APIs use string literals for constant 'enum' values. Some examples
of functions that do this are collectgarbage, select, type, io.type,
io.open, and coroutine.status (there are several more.)
IMO it's quite an acceptable idiom in Lua code. LÖVE[1] uses string literals
for all of its many 'enum' constants.
[1]: https://love2d.org
--
View this message in context: http://lua.2524044.n2.nabble.com/The-meaning-of-sugar-Forked-from-Re-Why-do-we-have-ipairs-tp7660591p7660695.html
Sent from the Lua-l mailing list archive at Nabble.com.
- References:
- Re: The meaning of 'sugar' [Forked from Re: Why do we have ipairs?], Roberto Ierusalimschy
- Re: The meaning of 'sugar' [Forked from Re: Why do we have ipairs?], Ross Bencina
- Re: The meaning of 'sugar' [Forked from Re: Why do we have ipairs?], Roberto Ierusalimschy
- Re: The meaning of 'sugar' [Forked from Re: Why do we have ipairs?], Paige DePol
- Re: The meaning of 'sugar' [Forked from Re: Why do we have ipairs?], Ross Bencina
- Re: The meaning of 'sugar' [Forked from Re: Why do we have ipairs?], Rena
- Re: The meaning of 'sugar' [Forked from Re: Why do we have ipairs?], Coda Highland
- Re: The meaning of 'sugar' [Forked from Re: Why do we have ipairs?], Ross Bencina
- Re: The meaning of 'sugar' [Forked from Re: Why do we have ipairs?], Thomas Jericke
- Re: The meaning of 'sugar' [Forked from Re: Why do we have ipairs?], Ross Bencina