New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE ember-metal-warn-on-undefined-get] #9950

wants to merge 1 commit into
base: master


None yet
3 participants

seanpdoyle commented Dec 16, 2014

Turn on Ember.ENV.WARN_ON_UNDEFINED_GET to expose typos in Ember.get calls
to undefined variables.

[FEATURE ember-metal-warn-on-undefined-get]
Turn on `Ember.ENV.WARN_ON_UNDEFINED_GET` to expose typos in `Ember.get`
calls to `undefined` variables.

This comment has been minimized.


seanpdoyle commented Dec 16, 2014

@rwjblue @ef4 this addresses some concerns that were raised at the last Ember Meetup in Boston.


This comment has been minimized.


tomdale commented Dec 16, 2014

I am not in favor of this. There are legitimate use cases for getting a property that is undefined; whether we believe it's right or not, this is just how the JavaScript ecosystem works today.

In a larger app, turning this on is going to generate many, many warnings.

I think a better approach is probably a computed property macro that just throws an exception when it's retrieved (indicating that it had never been set). Alternatively you can implement unknownProperty on the object in question and have it raise if it's invoked.

In general, there is a very high barrier to entry to adding new flags, especially if they are purely for debugging purposes. If there is a common problem people need to debug, I would much rather put time and energy into better debugging tools in the inspector than an esoteric flag that only pro users know to turn on and use.


This comment has been minimized.


seanpdoyle commented Dec 17, 2014

@tomdale 👌 you're right, a implementation, or an extension of Ember.Object that overrides unknownProperty is a better idea.

@seanpdoyle seanpdoyle closed this Dec 17, 2014


This comment has been minimized.


ef4 commented Dec 17, 2014

If you really want this kind of checking, you could get it in a more focused way by only extending the object that your own code is directly interacting with.

For example, if it's template usage that you're concerned about, extend all your Controllers & Components with an unknownProperty.

For usage within Javascript proper, you can just have your own get function and use it everywhere within your own code.

@seanpdoyle seanpdoyle deleted the seanpdoyle:warn-on-get-flag branch Dec 17, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment