Matt, using closures to simulate "private" properties/methods has
actually been around for quite some time : ) (one of the most famous
examples is probably Crockford's "module" pattern)
I actually found such technique almost essential when aiming for high-
performance appls. Not only it lets you "hide" certain logic, but also
allows to instantiate and cache most of the things before function is
ever run. As an example, take a look at an Object.forIn
implementation, where most of the "things" that actual method needs
are stored in a closure:
http://github.com/kangax/protolicious/tree/master/object.for_in.js
Best,
kangax
On May 12, 1:15 pm, Matt Foster <
mattfoste...@gmail.com> wrote:
> Hey Everyone,
>
> I found Kangax's observable class and the function closure used
> to create the instance and fell in love with the idea of easily
> created private methods. I've whipped up an article exploring this
> idea in much more detail. Feel free to check it out here,
http://positionabsolute.net/blog/2008/04/prototype-class-inheritance.php