Ember Auto - nicer properties with less this.get("junk")

Lots of good options here. Personally I think the eval concept may be too magical. Having these context-less, declaration-less variables may offer the cleanest syntax, but any Javascript developer will be left scratching their head. It’s just not how Javascript works. For people who prefer that level of terseness and magic, there is emberscript.

The option to specify {name: "user.name"} is great. I think it should be optional in all cases though. In other words, it shouldn’t be a requirement to access nested properties. If you are observing user.stats.age, I see no reason why user (or p.user) couldn’t be a sparse object. You get what you ask for. If you need the full user object, it’s available via this.get().

Great job so far everyone, particularly @gunn on the initial concept and implementation! Excited to see where this is headed… even more excited for ES6 to eventually make this moot. :slight_smile:

Wow, I’m looking forward to a solution. I’m hesitant about the eval/new Function approach. Also doing it that way changes the context (this).

@MiguelMadero I don’t think it does change the context. However I think I’ve found a solid reason to avoid using an eval/new Function- the chrome apps Content Security Policy doesn’t allow them - http://developer.chrome.com/apps/contentSecurityPolicy.html

Interestingly, we could change the function’s context to an object that proxied to the main object. That would allow this style with no eval:

greeting: function() {
  return "Hi " + this.name + " your login is: " + this.userName;
}.auto({name: "user.name"}, "userName")

Note the this’. It might cause trouble if this.name was shadowing a name property on the host object though.

@christopher +1 for ES6