lua-users home
lua-l archive

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


On 21 August 2015 at 12:16, 云风 Cloud Wu <cloudwu@gmail.com> wrote:
>
>
> Daurnimator <quae@daurnimator.com>于2015年8月21日周五 上午9:35写道:
>
>> 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 :-)
>
>
>>
>>   - following table semantics, there will always be a 'primary'
>> subtype that is used when the object is a table key
>>
> I think different fours can be different table key, because file handle 4 is
> different from numerical 4 . It's reasonable.


Indeed I think they should be.
But it's notable that it's not the case today with floats vs integers.

Quick poll:
  - Should filehandle(4) == integer(4)?
  - Should rawequal(filehandle(4), integer (4)) == true?
  - Should t = {}; t[filehandle(4)] = "foo"; t[integer(4)] == "foo"?
  - Should next({[filehandle(4)]=true}) == integer(4)?
  - Should rawequal(next({[filehandle(4)]=true}), integer(4))?

Currently with lua 5.3 and s/filehandle/float/:
  - Yes
  - Yes
  - Yes
  - Yes
  - Yes