News for hackers. Stuff that matters.
Re:Lua in the NetBSD Kernel [pdf] by vor_ on Monday February 18, 2013 @12:02PM (#5239204)
It's annoying building a class system by hand. I've got C functions I wrote to do it for me, but I wish I didn't have to.

There are certain behaviors I dislike even more. One example is a historical quirk in which all non-nil or non-false expressions are true. This means inconsistent behavior like:

while 0 do print("Loops forever") end while not 1 do print("Does nothing") end

and:

while 1 do print("Loops forever") end while not 0 do print("Does nothing") end

I also don't like how undefined variables return nil. This can cause a host of subtle errors, including accidentally creating sparse arrays if you make a typo in a variable name, which will mess up the behavior of the length operator.

The syntax, which is what most people complain about in Lua, really doesn't bother me. It's the sometimes unconventional behavior of the language and its minimal feature set.

Re:Lua in the NetBSD Kernel [pdf] by StavrosK on Monday February 18, 2013 @12:06PM (#5239237)
Hmm, I understand how 0 can evaluate to true (it's non-nil, non-false), but how is "not 1" false too, if 1 is true?
Re:Lua in the NetBSD Kernel [pdf] by vor_ on Monday February 18, 2013 @05:48PM (#5241298)
The only things that evaluate to false are nil and false, so applying the "not" operator to a true value (non-nil, non-false) will evaluate to false. Hence, "not 1" is false, as is "not 0".