IMHO, the only reason to define member functions from within the constructor is to make them what DC calls "privileged" functions: thanks to the closure, they have access to private state (local variables of the constructor function) yet are publicly accessible.

Any public function that just relies on public properties (this.xxx access) should be provided through the constructor's prototype as it consumes less memory and makes for faster instantiation.

As an added benefit (although I'm sure many will say it's Pandora's box from their POV), it opens the door to global overrides, AOP-style, as altering a function at the protototype level will impact all instances.

'HTH

--
Christophe Porteneuve
[email protected]

--
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to