I'm not sure what this has to do with anything. If a person doesn't know what Class.create does with an object (passed to it), it's their problem ; ) Bending language (and clogging performance) to meet inept programmers expectations doesn't seem like a wise thing to do. Adapting a "private members" pattern, on the other hand, is a decision every person/team has to decide for itself (as there are clear pros/ cons in each situation).
-- kangax On Jul 2, 5:48 pm, "Ryan Gahl" <[EMAIL PROTECTED]> wrote: > One more little illustration: > > var blah = Class.create({ > someArray: [], > initialize: function() {} > > }); > > var foo1 = new blah(); > var foo2 = new blah(); > foo1.someArray.push("blahblah"); > alert(foo2.someArray.length); //alerts 1, most people new to js will expect > 0 > > How many times has this issue been posted about here? People write something > like this, and expect the array to be unique for both instances, when in > fact it's shared (also known as static)... when in fact they really wanted: > > var blah = Class.create({ > initialize: function() { > this.someArray = []; > > } > }); --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---