lua-users home
lua-l archive

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


Proposed ability to 'mark' an argument in an imperative function call to transform it into an assignment statement.
Can be implemented as a purely syntactic translation with no change to the behaviour of the function or interpreter.
Syntax below uses unary '&' like c pointers and c++ reference signatures.

examples of use:
"trim(x, & veryLongName, z)" => "veryLongName = trim(x, veryLongName, z)"
"string.gsub(& line, '%s+', ' ')" => "line = string.gsub(line, '%s+', ' ')"

probably only useful on locals, since you can already "manually" translate
"trim(& veryLongName[complexLValue])" => "zap(trim, veryLongName, complexLValue)"

Criticism welcome.