Open Merlin04 opened 3 years ago
The anonymous functions need some work, I'll address this issue in the next release. The implicit anonymous functions are useful in cases like
arr -> .filter (@it % 2)
so I'd like to try and keep that syntax, but yes, your argument is valid and the issue should be resolved.
Personally, I'm not a fan of long anonymous functions, looking at a function it should be obvious what the function does.
A good read on this topic can be found here: https://hackernoon.com/three-reasons-i-avoid-anonymous-js-functions-like-the-plague-7f985c27a006
@Merlin04 for now, this works:
it passes the outer param to the inner anonymous function
Is your feature request related to a problem? Please describe. I came across Clio and it looks really cool, I'm excited to try using it for some projects! One issue I ran into is that in nested anonymous functions I can't figure out how to specify which parameters belong to which function.
For example, here's a function in JavaScript:
I'm not sure how I'd write this in Clio due to the nested anonymous functions creating ambiguity (I can't specify that
item
is a parameter of the inner function andm
is a parameter of the outer function):Describe the solution you'd like I'm not sure how this could be resolved while keeping Clio's implicit parameter syntax. Maybe there could be some sort of new syntax like JavaScript's
function() {}
that keeps thefn
and explicit arguments but still returns an anonymous function? Something like:Describe alternatives you've considered I could just write thing as a regular function:
But this doesn't return an anonymous function so it wouldn't be a valid workaround in all cases.