lua-users home
lua-l archive

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


On 25/03/2014 4.13, Andrew Starks wrote:
Pattern matching is not confusingly-related to plain old coercion. You're
dealing with string patterns, after all, or am I misunderstanding the
context of %d+?

I agree that number to string should always be "for free". I also agree
that ".." should always call __tostring, even on (especially) tables.

It's string to number. Strings are often used as magic words or alternates
types in arguments and it's better if things are clearer.

Might be better to relegate bad behavior... I mean implicit coercion :) to
a metamethod.

Yes, often the result of %d+ is used as a string in my code. Coercing it to a number would create more problems and/or inefficiencies (multiple unneeded conversions) than it would solve.

--
  Enrico