aboutsummaryrefslogtreecommitdiff
path: root/manual
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-08-24 10:17:54 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-08-24 10:17:54 -0300
commit8c8a91f2ef7acccb99e3737913faad8d48b39571 (patch)
tree0807151944b7f7fd00eedfcfe94b4ee26fe25b21 /manual
parentf99509581ee73c1c2dbddb3398e87c098771d31f (diff)
downloadlua-8c8a91f2ef7acccb99e3737913faad8d48b39571.tar.gz
lua-8c8a91f2ef7acccb99e3737913faad8d48b39571.tar.bz2
lua-8c8a91f2ef7acccb99e3737913faad8d48b39571.zip
Deprecated the emulation of '__le' using '__lt'
As hinted in the manual for Lua 5.3, the emulation of the metamethod for '__le' using '__le' has been deprecated. It is slow, complicates the logic, and it is easy to avoid this emulation by defining a proper '__le' function. Moreover, often this emulation was used wrongly, with a programmer assuming that an order is total when it is not (e.g., NaN in floating-point numbers).
Diffstat (limited to 'manual')
-rw-r--r--manual/manual.of21
1 files changed, 9 insertions, 12 deletions
diff --git a/manual/manual.of b/manual/manual.of
index 5a8b1b2c..47a551bf 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -474,17 +474,7 @@ The result of the call is always converted to a boolean.
474 474
475@item{@idx{__le}| 475@item{@idx{__le}|
476the less equal (@T{<=}) operation. 476the less equal (@T{<=}) operation.
477Unlike other operations, 477Behavior similar to the less than operation.
478the less-equal operation can use two different events.
479First, Lua looks for the @idx{__le} metamethod in both operands,
480like in the less than operation.
481If it cannot find such a metamethod,
482then it will try the @idx{__lt} metamethod,
483assuming that @T{a <= b} is equivalent to @T{not (b < a)}.
484As with the other comparison operators,
485the result is always a boolean.
486(This use of the @idx{__lt} event can be removed in future versions;
487it is also slower than a real @idx{__le} metamethod.)
488} 478}
489 479
490@item{@idx{__index}| 480@item{@idx{__index}|
@@ -1643,7 +1633,8 @@ all operations @emphx{wrap around},
1643according to the usual rules of two-complement arithmetic. 1633according to the usual rules of two-complement arithmetic.
1644(In other words, 1634(In other words,
1645they return the unique representable integer 1635they return the unique representable integer
1646that is equal modulo @M{2@sp{64}} to the mathematical result.) 1636that is equal modulo @M{2@sp{n}} to the mathematical result,
1637where @M{n} is the number of bits of the integer type.)
1647} 1638}
1648 1639
1649@sect3{bitwise| @title{Bitwise Operators} 1640@sect3{bitwise| @title{Bitwise Operators}
@@ -8537,6 +8528,12 @@ For instance, the result of @T{"1" + "2"} now is an integer,
8537not a float. 8528not a float.
8538} 8529}
8539 8530
8531@item{
8532The use of the @idx{__lt} metamethod to emulate @id{__le}
8533has been removed.
8534When needed, this metamethod must be explicitly defined.
8535}
8536
8540} 8537}
8541 8538
8542} 8539}