Re:Plug and Play All Your Observable Streams With Cycle.js
by tobr on Friday November 06, 2015 @06:57AM
(#10519009)
If you want to adopt a functional style, then there is little benefit to using `this` instead of regular arguments or closures, which are more versatile and follow more straightforward rules. I think most JS developers have been confused over the value of `this` more than once.
[ Parent
| on HN ]
Re:Plug and Play All Your Observable Streams With Cycle.js
by bryanrasmussen on Friday November 06, 2015 @07:16AM
(#10519058)
I would think call and apply would be useful for a functional style, but no?
Re:Plug and Play All Your Observable Streams With Cycle.js
by RobertKerans on Friday November 06, 2015 @07:46AM
(#10519154)
YMMV, but I thought I would use them more regularly the more I wrote my JS in a functional style, but the use cases started to steadily dry up; it's gets much easier to write code that simply doesn't need to hold the reference in that way. Arrow functions help a great deal (there is no concept of `this` within them). Still very useful, but in very specific cases, or abstracted off into helpers. I've found `bind()` is much more useful (and will become moreso if the bind operator is okayed and optimised).