lua-users home
lua-l archive

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

> 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.
> Lua coerces only to 'number' and 'string'.  There can be no ambiguity.
> Let the context decide.
> If you prefer instead overloading '+' and '*' to mean concatenation
> and repetition, you can always revert to Python.

That are two logical fallacies. First the ones that think weak types
and automatic conversation is a bad idea is not because they got not
the option to add a "tostring" function - which would be an empty
function for the current core, but the implicity of stuff happening
and the bugs that can spawn, like number string conversations is
pretty bad. Or table lookups not misdirecting, etc. It might depend on
the context but even in languages with strong types I hardly see it
"clutter" with tostring or tonumber, as generally you should avoid
them, cause they make your stuff slow. Second falacy is the python
one, just by avoiding weak string/number types doesn't mean you must
be like python and use + and * or so.