lua-users home
lua-l archive

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


> > Message d'origine De la part de Roberto Ierusalimschy
> >
> > The expression "1".."2"^3 would get a different meaning (1728, instead
> > of "18"). The same for -"1".."2" (subtle difference) or #"3".."5".
> > 
> 
> Pardon my ignorance, but what is the usefulness of being able to treat
> strings containing numbers as if they were numbers to begin with? [...]

Even if Lua did not coerce strings to numbers the problem would exist.
For instance, without coercion, it could be useful to allow metamethods
for arithmetic operations over strings (e.g., "a"^3 could result in "aaa").

It is always a bad idea to cripple some syntactical construction only
because it happens to not have a useful semantics.

-- Roberto