[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RFC: "in place" return from imperative function calls
- From: Griffin Rock <abcq2@...>
- Date: Tue, 13 Aug 2019 04:11:04 +0000
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.