Re:TC39, ECMAScript, and the Future of JavaScript
by spleeder on Monday June 26, 2017 @07:47PM
(#14641393)
I for one am not. What is wrong with calling a plain function?
[ Parent
| on HN ]
Re:TC39, ECMAScript, and the Future of JavaScript
by SimeVidas on Monday June 26, 2017 @08:20PM
(#14641570)
You need to use `.bind()` to set the context, or switch to using arrow functions. Both methods are sub-optimal. `@autobind` solves that.
Re:TC39, ECMAScript, and the Future of JavaScript
by tlrobinson on Monday June 26, 2017 @09:12PM
(#14641814)
Why is
@autobind
foo() {
// ...
}
more optimal than foo = () => {
// ...
}
?
Re:TC39, ECMAScript, and the Future of JavaScript
by jopsen on Tuesday June 27, 2017 @03:40AM
(#14643232)
Please, Nothing is ever _more optimal_.
Re:TC39, ECMAScript, and the Future of JavaScript
by k__ on Monday June 26, 2017 @09:08PM
(#14641794)
Class properties solve that too, with less magic IMO.
Re:TC39, ECMAScript, and the Future of JavaScript
by dtzur on Tuesday June 27, 2017 @02:19AM
(#14642916)
Decorators are awesome! Stop this blasphemy.
Re:TC39, ECMAScript, and the Future of JavaScript
by solidr53 on Tuesday June 27, 2017 @12:15AM
(#14642527)
Bad example, checkout mobx or core-decorators.
@computed get value() { return this.a + 1; } @readonly bar = 5;
Re:TC39, ECMAScript, and the Future of JavaScript
by RonanTheGrey on Tuesday June 27, 2017 @02:12PM
(#14647765)
The use of decorators in Anguar 2/4 is also very well done, IMHO. They allow your class to focus on its business logic, rather than the minute details of how Angular expects it to interact with the rest of Angular.
There's a reason all the most common languages have them, concealing complexity is a way to reduce cognitive overload and therefore, bugs.