News for hackers. Stuff that matters.
Re:Ember.js 2.7 and 2.8 beta released by orf on Tuesday July 26, 2016 @04:24AM (#12164116)
EmberJS uses strings as property paths. You can use 'foo.bar.firstObject.baz' as a unique key the same as any other function that takes a property paths (like a computed property). In Ember you write a lot of these so any small overhead like a lambda is a bit of a waste.

Also I don't think ember would work with functions instead of strings, the whole point of the strings is that the unique function is only called when one of the items in the property paths changes, and you can't get that from functions. You can only evaluate them.

Re:Ember.js 2.7 and 2.8 beta released by Longwelwind on Tuesday July 26, 2016 @06:51AM (#12164685)
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.

Re:Ember.js 2.7 and 2.8 beta released by orf on Tuesday July 26, 2016 @08:55AM (#12165243)
I 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 `[email protected]`.

Perhaps a good middleground would be to do something like C#'s LINQ stuff, where the lambdas are analysed and the values extracted.