emberjs/ember.js — pull request #3339 by mbixby (2013-09-05 11:07:15+00:00)
Title: Close #3307 – Fix unexpected behavior with functions in concatenated properties

Two remarks:

* The bug was caused by wrong order of two conditions in `addNormalizedProperty` in `mixin.js`. Seeing the history of that file, I was surprised how few bugs it caused, so hats off to core developers.

* Why are concatenated (and merged) properties not implemented using `@_super` and computed properties? Seems so straightforward:
```coffeescript
ConcatenatedProperty = (value, opts = {}) ->
@func = (key, newValue, cachedValue) ->
if arguments.length is 1
cachedValue ? do =>
previous = if opts.isBaseValue then [] else @_super()
previous.concat Ember.makeArray value
else
previous = if opts.isBaseValue then [] else @_super key
previous.concat Ember.makeArray newValue

ConcatenatedProperty.prototype = ComputedProperty

M = Ember.Object.extend
# concatenatedProperties: ['shared']
shared: new ConcatenatedProperty Ember.K, isBaseValue: yes
N = M.extend
shared: new ConcatenatedProperty Ember.K

shared = N.create().get 'shared'
expect(shared).to.have.members [Ember.K, Ember.K]
```