[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Feature request: userdata slice
- From: Daurnimator <quae@...>
- Date: Fri, 21 Aug 2015 11:35:11 +1000
On 21 August 2015 at 08:48, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
>> So different metatable for 4 than for 5? That would be... interesting.
>
> Actually, different fours could have different metatables :-)
This whole concept sounds very scary to me.
Subtypes make for strange and weird semantics;
we already have a 4 that's not a 4:
Lua 5.3.1 Copyright (C) 1994-2015 Lua.org, PUC-Rio
> 4 == 4.0
true
> rawequal(4, 4.0)
true
> math.type(4) == math.type(4.0)
false
> t = {}; t[4] = "foo"; print(t[4.0])
foo
> math.type(next({[4.0]=true}))
integer
This breaks currying, memoization, and other useful things.
Extending this to other types seems to be asking for a mess.
- it seems like we need a rawrawequal();
- following table semantics, there will always be a 'primary'
subtype that is used when the object is a table key
- References:
- Re: Feature request: userdata slice, Philipp Janda
- Re: Feature request: userdata slice, 云风 Cloud Wu
- Re: Feature request: userdata slice, Dirk Laurie
- Re: Feature request: userdata slice, 云风 Cloud Wu
- Re: Feature request: userdata slice, Dirk Laurie
- Re: Feature request: userdata slice, Dirk Laurie
- Re: Feature request: userdata slice, Tim Hill
- Re: Feature request: userdata slice, William Ahern
- Re: Feature request: userdata slice, Roberto Ierusalimschy
- Re: Feature request: userdata slice, Rena
- Re: Feature request: userdata slice, Roberto Ierusalimschy