4 ms·
i want it! it will increase my job security with features like this : == String name => firstName + " " + lastName; And an assignment: String name = firstNa
by trhway 11y ago
i want it! it will increase my job security with features like this :
==
String name => firstName + " " + lastName;
And an assignment:
String name = firstName + " " + lastName;
In the first example, the expression is recomputed every time name is evaluated. In the second example, the expression is computed once and the result assigned to name.
==
A function which looks like just a variable and recomputed each time! Happy debugging my code, suckers!
- findjashua 11y agoi've been using fat arrows for function definitions in es6, and haven't had a problem. I think the confusion in your code has more to do with poor code than fat arrows.
- Lazare 11y agoSpeaking as someone who has done quite a lot of work using languages with terse lambda syntax... ...that's just not ever an issue.
- sixbrx 11y agoi think the poster thinks that with the fat arrow definition, name becomes an implicitly called function wherever it is used. I wouldn't like that either. but, I dont know if thats really the case though (I dont know ceylon). I think that fat arrow line would just become a no op instead, creating a lambda and throwing it away immediately ("name" being the param name in the lambda and nothing more).