lua-users home
lua-l archive

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


On 2016-07-13T10:11, Dirk Laurie wrote:
> But it is not so easy if you have to worry all the time whether
> 'str1 ~ str2' might not just decide to xor the bits instead of performing
> whatever cute operation you have been using the syntax for. And if
> you actually like the present behaviour, you can always supply
> a metatable for that.

Wouldn't it be enough if the auto-coercion (in any direction) happens
_after_ checking for a metamethod? If that's reasonably easy to
implement, that may be the way to go.

For code not using metamethods on strings/numbers, nothing would change.
(And I'd guess that code using metamethods on strings/numbers is more
likely to be corrected by this than to be broken.)