moonscript
moonscript copied to clipboard
Table Comprehension Leads to Silent Error in Destructuring Assignment
Receivers in LHS will be nil
when destructuring is used on table comprehensions. No error emitted by the compiler:
foo = "1 2 foobar"
-- works as expected:
items = [ w for w in foo\gmatch("%S+") ]
{one, two, three} = items
-- all receivers nil:
{one, two, three} = [ w for w in foo\gmatch("%S+") ]
This contradicts other behavior where table comprehension expressions can be used instead of variable identifiers which contain tables.
Possibly a dupe: #449