Closed demark closed 11 years ago
I've considered this feature, but been dismissing it due to:
[a, b] = f(.)
.So, what if strict assignment with reference only to ordinary variables (e.g. a = ...
, b = ...
)
Second, afaik this overhead will only cause on preprocess. In js-output there only need to replace reference symbols. Am i right?
only to ordinary variables
Yup, we'd have to disallow it on destructuring LHS.
this overhead will only cause on preprocess
Right.
Whipped up a trial impl there. Some notes:
<>
. Standalone .
as proposed is too iffy.f = -> <>
is syntax error.Merged as is.
Currently we have this sugar:
some.long.long.long.variable .= to-upper-case!
But we often have a lot of functions from some libs that takes var as argument and returns new value.
I suggest to add
.
(dot) as variable reference in the assignment block:And we can use
some.long.long.long.variable = . .to-upper-case!
Maybe instead of dot use
&.
or$&
(like in regex)I think this will be very usable.