lua-users home
lua-l archive

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


On Tue, Nov 16, 2021 at 1:47 PM Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
The complete diffs from Lua 5.4.3 are available at
        http://www.lua.org/work/diffs-lua-5.4.3-lua-5.4.4.html
        http://www.lua.org/work/diffu-lua-5.4.3-lua-5.4.4.html

doc/manual.html

@@ -1636,8 +1636,10 @@
 
 
 <p>
-The assignment statement first evaluates all its expressions
-and only then the assignments are performed.
+If a variable is both assigned and read
+inside a multiple assignment,
+Lua ensures all reads get the value of the variable
+before the assignment.
 Thus the code
 
 <pre>

@@ -1662,6 +1664,14 @@
 
 
 <p>
+Note that this guarantee covers only accesses
+syntactically inside the assignment statement.
+If a function or a metamethod called during the assignment
+changes the value of a variable,
+Lua gives no guarantees about the order of that access.
+
+
+<p>
Why are we losing this guarantee? Especially in a bugfix release? If there is code relying on the previous guarantee (that all expressions are evaluated first) that worked in Lua 5.4.3, that code is now broken (even if only by documentation) in Lua 5.4.4. So why a breaking (documentation) change in a bugfix release?