Banjo

52 thoughts
last posted Nov. 9, 2015, 7:13 p.m.

7 earlier thoughts

0

One thing I seem to do a LOT in Java, Lua, Javascript is copy local variables to a same-named field of a record. Some kind of sane syntax to make that easier would be really nice.

Current approach:

f(a,b) = {a, b}

By not supplying a value, the value is copied from scope as a method.

Also the opposite - extract variables from an object into local variables:

{a,b} = {a = 1, b = 2} // Set a=1, b=2

To rename:

{foo = a, bar = b} = {foo = 1, bar = 2} // Set a=1, b=2

44 later thoughts