News for hackers. Stuff that matters.
Re:Encapsulation in Javascript by jashkenas on Tuesday September 13, 2011 @12:40PM (#2992203)
The browsers are getting better at optimizing memory use for small closures all the time, but there's still a long way to go. Here's a screenshot of the Chrome heap profiler for both cases:

http://cl.ly/A5NX

Re:Encapsulation in Javascript by mun2mun on Tuesday September 13, 2011 @04:07PM (#2993287)
I have one question. How to handle private methods in prototype/module pattern? If I declare private function in obj function declaration I can not access it in public functions attached to the prototype of obj. This is also true for module pattern. This problem arises when I need to add extra method later. How to overcome this situation?