on teh same ish subject, this cropped up on ajaxian today !!... might be worth a read
http://ajaxian.com/archives/trying-to-be-private-in-javascript ----- Original Message ----- From: "Mona Remlawi" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Monday, November 17, 2008 3:43 PM Subject: [Proto-Scripty] Re: private methods/variables declaration > > Super, I like the word "shared". I'll keep an eye not to have any > state in the private block :-) > > cheers > > -- > mona > [EMAIL PROTECTED] > > On Mon, Nov 17, 2008 at 4:23 PM, kangax <[EMAIL PROTECTED]> wrote: >> >> On Nov 17, 4:13 am, "Mona Remlawi" <[EMAIL PROTECTED]> wrote: >> [...] >>> I'm wondering if this is a good practice. Are there any insights that >>> i should be aware of? Are the private methods/functions being >>> duplicated for each of myclass instance? >> >> If what you need is to create private static ("class") members, then >> yes, this is one of the most straight-forward ways to do so. Private >> functions are not being duplicated; they are declared only once. When >> an instance is created, public instance methods are still "shared" via >> prototype chain, but also have an access to private functions (as they >> were declared in the same scope). >> >>> >>> Thanks in advance >>> >>> -- >>> mona >>> [EMAIL PROTECTED] >> >> -- >> kangax >> > >> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---
