[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.3.0 (work2) now available (number coercion holy crusade)
- From: Tim Hill <drtimhill@...>
- Date: Mon, 24 Mar 2014 21:41:05 -0700
On Mar 24, 2014, at 9:32 PM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> 2014-03-25 5:13 GMT+02:00 Andrew Starks <andrew.starks@trms.com>:
>
>> I also agree that ".." should always call __tostring, even on (especially) tables.
>
> I don't agree. Lua should "not know what to do" so that a metamethod will be
> looked for. Otherwise we can chuck away the __concat metamethod.
>
I agree, and your example highlights the deeper difference between operator metamethods and coercion metamethods. I’d hate to see Lua ending up as messy as C++ where figuring out which function was called involves looking at templates, signatures, automatic casts etc etc .. (shudders).
I think __tostring() should get invoked ONLY when tostring() is explicitly called.
—Tim
- References:
- [ANN] Lua 5.3.0 (work2) now available, Luiz Henrique de Figueiredo
- Re: [ANN] Lua 5.3.0 (work2) now available, Egor Skriptunoff
- Re: [ANN] Lua 5.3.0 (work2) now available, Roberto Ierusalimschy
- Re: [ANN] Lua 5.3.0 (work2) now available, Andrew Starks
- Re: [ANN] Lua 5.3.0 (work2) now available, Roberto Ierusalimschy
- Re: [ANN] Lua 5.3.0 (work2) now available (number coercion holy crusade), katlogic
- Re: [ANN] Lua 5.3.0 (work2) now available (number coercion holy crusade), Roberto Ierusalimschy
- Re: [ANN] Lua 5.3.0 (work2) now available (number coercion holy crusade), Hisham
- Re: [ANN] Lua 5.3.0 (work2) now available (number coercion holy crusade), Rena
- Re: [ANN] Lua 5.3.0 (work2) now available (number coercion holy crusade), William Ahern
- Re: [ANN] Lua 5.3.0 (work2) now available (number coercion holy crusade), Andrew Starks
- Re: [ANN] Lua 5.3.0 (work2) now available (number coercion holy crusade), Dirk Laurie