3 ms·
Thanks, I didn't know that Ember did more than just fetching the value. About time wasted, I feel like in the long run, you gain more time by writing staticall
by Longwelwind 10y ago
Thanks, I didn't know that Ember did more than just fetching the value.
About time wasted, I feel like in the long run, you gain more time by writing statically analyzable code. If you make a typo in the string, you would have to build/transpile+launch the code in order to see the error. Additionaly, if you ever refactor the name of the property, the linter will directly tell you that "value" in the lambda must be changed.
- orf 10y agoI agree and one of the downsides is exactly this. I've felt this pain before :( But there is no way around it - property keys are strings because they can be many layers deep (`foo.bar.test.abc`), and if any of those are undefined then the result is undefined. Also any of those properties (`foo`, `bar`, `test` or `abc`) could be themselves computed properties that depend on others. You also get features like `@each`, used for arrays like `foo.@each.bar`. Perhaps a good middleground would be to do something like C#'s LINQ stuff, where the lambdas are analysed and the values extracted.