In the same context as the Native Class Roadmap
there is currently an open RFC proposing to change the behavior of EmberObject's constructor.
Native class syntax with EmberObject
has almost reached full feature parity, meaning soon Ember will be able to ship native classes.
However, early adopters of native classes have experienced some serious issues due to the current behaviour of the class constructor. The issue is caused by the fact that properties passed to EmberObject.create
are assigned to the instance in the root class constructor
. Due to the way that native class fields work, this means that they are assigned before
any subclasses' fields are assigned, causing subclass fields to overwrite any value passed to create.
The new implementation
would ensure that
these properties are assigned after all of the class fields for any subclasses have been assigned.
One thing worth mentioning is that EmberObject
will likely be deprecated
in the near future and that ideally for non-Ember classes (things that aren't Components, Services, etc.) users should drop EmberObject
altogether and use native classes only.
👉 As always, all comments to this RFC
are more than welcome, so let's help out in order to finalize it! ✨