Re:Lua: Good, bad, and ugly parts
by Stratoscope on Saturday March 09, 2013 @07:55PM
(#5350206)
(1) is a number. (not 0) is (false), a boolean. How could they be the same? They must be different because they are different types.
[ Parent
| on HN ]
Obviously there are reasons for the behavior, but it's still inconsistent to users who are exposed to your scripting API to have:
if 1 then print "true" end
if 1 == true then print "never prints" end
Not a reason to avoid the language. But it may be a reason to consider an alternative with more conventional behavior.If you replace 1 with 2 this is an argument against using a vast number of languages, including Squirrel, I think. So maybe you're really saying that languages should forbid non-Boolean values in if statements. Maybe I agree with that.