[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Coercion: which do we want in the next version?
- From: nobody <nobody+lua-list@...>
- Date: Thu, 14 Jul 2016 00:33:45 +0200
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.)