3 ms·
I for one am not. What is wrong with calling a plain function?
by spleeder 9y ago
I for one am not. What is wrong with calling a plain function?
- SimeVidas 9y agoYou need to use `.bind()` to set the context, or switch to using arrow functions. Both methods are sub-optimal. `@autobind` solves that.
- k__ 9y agoClass properties solve that too, with less magic IMO.
- dtzur 9y agoDecorators are awesome! Stop this blasphemy.
- tlrobinson 9y agoWhy is @autobind foo() { // ... } more optimal than foo = () => { // ... } ?
- jopsen 9y agoPlease, Nothing is ever _more optimal_.
- solidr53 9y agoBad example, checkout mobx or core-decorators. @computed get value() { return this.a + 1; } @readonly bar = 5;
- RonanTheGrey 9y agoThe 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.