lua-users home
lua-l archive

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

Von: Dirk Laurie<>

> On Thu, Feb 10, 2011 at 07:54:56AM +0200, Miles Bader wrote:
> > 
> > I don't think anybody actually thinks the automatic conversion is a
> > good idea these days, but it's there for historical reasons.
> > 
> I think it's a good idea.  You've got the option to fill your program
> with 'tonumber' and 'tostring' if you think automatic conversion is
> bad, but you are not forced to do so.  That's the Lua way.

I don't quite think so. Automatic conversion is... well, not necessarily an all out bad thing, but it does cause confusion, as you can see from the OP. Also, if you take it too far, like for example PHP has done, you end up with

0 == "" == "0" == "00" == "000" == ...

which is outright evil. In a (little) way lua also does that in the contexts where it does automatic conversion, but luckily it only does so in arithmetic expressions. I can live with that, more would cause problems.