Is that a supported way to mutate an ember array? o_0 cc @rwjblue
I would not expect someArray.set('firstObject', 'foo'); to set the first item today, though I do suppose that if you think about it when you call someArray.get('firstObject') it works so it is somewhat surprising that you can't set it...
I would expect that the call either sets it or raises a readOnly assertion (Cannot set read-only property firstObject on object: x).
@Serabe - Ya, I agree that silently failing isn't good. I would lean towards making it a readOnly error I think...
Open to suggestions from @krisselden / @mmun though...
Setting firstObject should raise an error, yes. It might be possible that this introduces errors in people's apps where there weren't any previously, e.g. in {{foo-bar baz=array.firstObject}} because of the two-way binding, but I'd guess it would be pretty rare.
Ya, it seems rare and also a likely source for other bugs...
Perhaps some clarity can be added to the API docs for firstObject that it should not be set. The doc does mention that its a helper method to get something. But since its listed as a property one would think that it's ok to get and set. Which is not the case.
Most helpful comment
@Serabe - Ya, I agree that silently failing isn't good. I would lean towards making it a
readOnlyerror I think...Open to suggestions from @krisselden / @mmun though...