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).
This commit is contained in:
Roberto Ierusalimschy
2018-08-24 10:17:54 -03:00
parent f99509581e
commit 8c8a91f2ef
8 changed files with 44 additions and 40 deletions

View File

@@ -295,7 +295,7 @@
*/
/*
@@ LUA_COMPAT_5_3 controls other macros for compatibility with Lua 5.2.
@@ LUA_COMPAT_5_3 controls other macros for compatibility with Lua 5.3.
** You can define it to get all options, or change specific options
** to fit your specific needs.
*/
@@ -316,6 +316,12 @@
*/
#define LUA_COMPAT_APIINTCASTS
/*
@@ LUA_COMPAT_LT_LE controls the emulation of the '__le' metamethod
** using '__lt'.
*/
#define LUA_COMPAT_LT_LE
#endif /* } */