lua-users home
lua-l archive

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


The 5.2.2 manual spell out the details of metamethods in pseudo-Lua.
The 5.3-work2 manual only does so in English, which is usually rather
different from the English of the 5.2.2 manual — understandably so,
since some things from the pseudo-Lua code now need to be said.

The description of metamethods therefore demands very careful
reading. So far I've found one subtle linguistic imprecision
in the new version, the description of __eq.

5.2.2: A metamethod is selected only when both values being compared
have the same type and the same metamethod for the selected operation,
and the values are either tables or full userdata.

5.3.work2: Lua will try a metamethod only when the values being
compared are both either tables or full userdata, both have the same
metamethod, and they are not primitively equal.

5.2.2 does not say "they are not primitively equal", but the code
shows it. 5.3.work2 does not say "have the same type", but
implies it by the word "both" and saying "tables" rather than
"a table". The point could be made more strongly by a small
change in the wording:

Lua will try a metamethod only when the values being compared are
either both tables or both full userdata, both have the same
metamethod, and they are not primitively equal.


2014-03-21 22:44 GMT+02:00 Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br>:
> Lua 5.3.0 (work2) is now available for testing at
>         http://www.lua.org/work/lua-5.3.0-work2.tar.gz
>
> MD5     52bd13d0b40f637bc388a133b9bb8771  -
> SHA1    e52ea0acf4b2d7bf042f48bd01dddc149d517184  -
>
> This is a work version. An updated reference manual is included but
> all details may change in the final version. See
>         http://www.lua.org/work/doc/readme.html
>
> The main change in Lua 5.3.0 is the introduction of integers.
> For other changes, see
>         http://www.lua.org/work/doc/readme.html#changes
>
> The complete diffs from work1 are at
>         http://www.lua.org/work/diffs-lua-5.3.0-work1-work2.txt
>
> Enjoy. All feedback welcome. Thanks.
> --lhf
>
>