[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: The meaning of 'sugar' [Forked from Re: Why do we have ipairs?]
- From: Ross Bencina <rossb-lists@...>
- Date: Fri, 13 Jun 2014 12:58:07 +1000
On 13/06/2014 12:15 PM, Coda Highland wrote:
On Thu, Jun 12, 2014 at 7:12 PM, Rena<firstname.lastname@example.org> wrote:
>On Wed, Jun 11, 2014 at 10:13 PM, Ross Bencina<email@example.com>
>>The problem is in Lua (unless I'm missing something), you don't have
>Well, Lua *does* have constants:
String literals are *not* symbolic constants.
> case 'move' print("I was moved to", event.x, event.y) break
> case 'resize' print("I was resized to", event.w, event.h) break
> case else print("I don't know how to deal with", event.type)
And thanks to string interning, these are as fast as integer comparisons.
That doesn't help you when you already have an integer.
I'll leave it to others to determine whether using string literals in an
interface is ever good style.