lua-users home
lua-l archive

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


On Tue, Dec 4, 2012 at 7:59 AM, steve donovan <steve.j.donovan@gmail.com> wrote:
> On Tue, Dec 4, 2012 at 2:40 PM, spir <denis.spir@gmail.com> wrote:
>> One more point for genuine bools ;-) (hum...)
>
> One of my most common errors is to say 'if foo then ... end' when I
> _really_ mean 'if foo==nil then .. end'.
>
> Kind people then write to me to ask why I am so prejudiced against
> genuine false values.
>
> But still, just because it's a common sloppy mistake, does not mean
> that the language itself must make it impossible to be sloppy.
>
> steve d.
>

I write "if foo then" all the time, in cases where foo should never be
false anyway, but may be nil, or vice-versa. If it ever is, then
something's wrong elsewhere, and neither treatment can be considered
correct.

-- 
Sent from my Game Boy.