News for hackers. Stuff that matters.
Re:AngularJS from an Ember.js perspective by pcwalton on Thursday November 21, 2013 @09:30PM (#6778887)
JavaScript hasn't had simple data access for a long time if ever. Computed properties have been widely supported for a long time, there's "watch" [1], and of course there's the prototype chain. ES6 adds proxies, which makes practically everything you might want to do with an object potentially have custom behavior. IMHO, in JavaScript you might as well respect the uniform access principle, since "a.b" meaning simple data access has arguably never existed.

[1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

Re:AngularJS from an Ember.js perspective by emn13 on Saturday November 23, 2013 @06:29PM (#6787906)
Since code could be self-modifying; clearly simple-data access has never been a guarrantee.

But in practice, today as ever, it's a good guideline. When you see an accessor, it will almost always be fast and side-effect free.

Now, part of that is because not all browsers support the features you refer to and therefor these features just don't get used much. But even in languages like C# and python, that have had real accessors for a long time, it's still a good guideline: it's generally considered bad practice to make a slow, side-effectful accessor, and most people don't.

Controlling side effects and performance are important, and the uniform access principle has little upside in most non-public code, yet considerable cost in that it obscures one of the few indicators mainstream languages have for these aspects.