News for hackers. Stuff that matters.
Re:Ember.js 2.7 and 2.8 beta released by pandler on Tuesday July 26, 2016 @04:28AM (#12164130)
> if you do a typo in the name of the property, it can be caught by a linter/compiler

There isn't really great linter/compiler support for ember anyways, mainly because of how you're forced to use getters and setters. In ember, your example would look like

    var arr = [{ value: 'a' }, { value: 'a' }, { value: 'b' }, { value: 'b' }];
    arr.uniqBy(element => element.get('value'));  // [{ value: 'a' }, { value: 'b' }]
The `element.get('value')` syntax makes it hard to do static analysis on your code. It's a bit of a pain point, but that design decision wasn't arbitrary and there are lengthy explanations for why they designed the framework like that.

> Are there any advantages to use a string instead of a "static" way of accessing the property ?

It's just shorthand for (what I imagine is) the most common use-case. Keep in mind that `uniqBy` is a property macro, which provide simplified apis for very specific use-cases. You always have the ability to write more complex, custom computed properties.

There are no comments on this comment yet.