lua-users home
lua-l archive

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


It was thus said that the Great Elias Hogstvedt once stated:
> If there was a vote of some sort I'd vote to remove this feature as it just
> complicates things (mainly tools that communicate with lua) without really
> much gain IMHO.

  I use the foo"" method often when using LPeg, especially with the P()
function (primarily used to match literal strings).  And oddly enough, I
omit the parenthesis when using require.  I don't know.  I like the feature
and would personally hate to see it go.

> I have a similar feeling about having single and double quotes but I'm not
> really sure what the consequences would be if either was removed. I guess
> it's mainly convenient if you want to write the other quote in a string
> without the need to escape? But what other benefits would it have? I have
> often misread strings whenever there's use of both in them since the double
> quote can look like 2 single quotes and so on.

  I use the single quotes around single words and double quotes around
strings containing multiple words (generally---there are exceptions).  To
me, the single quote is used to designate what would be an enum in C.  Some
example:

	syslog('warning',"current pressure: %f",pressure)

	window  = display:window(
                        nil,
                        0,
                        0,
                        WIDTH,
                        HEIGHT,
                        0,
                        nil,
                        {
                          event_mask = 
                          {
                            'ExposureMask',
                            'StructureNotifyMask'
                          },
                          background_pixel = 'green'
                        }
                )

	signal.catch('interrupt',signal_handler,'restart')

	x = string.format("the %s has hit the %s",organic_material,cooling_unit)

Perhaps it's silly to make such a distinction, but that's how I tend to use
single and double quotes.

  -spc