> Python programmers want assignment expressions because Python's comprehension syntax is so heavily used.
This is not a valid reason why a similar device cannot be beneficial in Lua.
Both examples shown in the rationale can be easily adapted to Lua and would be just as convincing.
So I would say the benefit of such a mechanism is not specific to Python and it is valid to consider it for Lua, too.
Just about any procedural language (Lua included) might force the user to write something like:
local x = func() -- expensive
if x > 0 then
-- use x
end
The problem with the above is the pollution of an outer namespace, not to mention it is forced rather than natural. A bigger problem with that is the scope of the variable thus introduced with respect to its termination (to-be-closing) - instead of being that of the if-statement, it is the outer scope.
Ultimately, Lua has its own problem where one cannot write
local x = foo(), y = bar(x)
The correct version of that is more verbose and feels forced and unnatural. More so when it combines with the previous problem.
So while we are talking about all the weird and wonderful new semantics for Lua variables, it might be prudent to consider this, as well. Perhaps we could end up with something synthesizing multiple benefits, thus making it more likely to appear in Lua.
Cheers,
V.