lua-users home
lua-l archive

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


On Mar 7, 2013, at 9:00 AM, Daniel Silverstone <dsilvers@digital-scurf.org> wrote:

> On Thu, Mar 07, 2013 at 12:53:04PM -0300, Luiz Henrique de Figueiredo wrote:
>>> I'd prefer to see ¬= myself.  Makes more sense to me than ~= and != both.
>> 
>> Since ¬ is not ASCII, we opted for ~ . In logic, both ¬ and ~ are used
>> for "not": http://en.wikipedia.org/wiki/Negation#Notation
> 
> Haskell uses /= in an attempt to make it look a little more like a ≠.  A
> language I used a bit on a uni course used == for equality and =/= for
> inequality.
> 
> I *like* Lua's ~= and hardly think it's a problem for people much.

It's a bit of unconventional syntax for which I occasionally relapse, second only to writing "then" for every "if".

However, if there was syntax I could have officially changed, it would be the requirement to delimit per-line table elements with a comma in a table declaration. According to a past thread, elements with bracketed keys would still require commas, but I'd consider that an acceptable caveat to allow for the combination of comma-less table declarations and single-argument function calls in declarative DSLs:

-- alias() registers a command in an imaginary host application.
alias {
    name = "example"
    description = "Just an example."
    options = { EXAMPLE_OPTION1, EXAMPLE_OPTION2 }
    handler = function(args)
        -- Do things.
    end
}

Preston