Thanks, Derrell,

What you describe below perfectly explains my problem. In my real code,
I have something like

  foo: { bar: 1 }

and this is causing all copies of foo to get initialized to the same
reference;
hence the object is shared across all instances.

While this is working as advertised, it seems very counter-intuitive. It
seems
to me that the "features for object orientation" doc ought to include a
warning
about this. (Even better would be to have QooxDoo recognize this situation
and prohibit it: the proper way to share data across instances is to use
statics, no?)

Dave
--------------------------------------

On Tue, Oct 6, 2009 at 16:55, dmbaggett <[email protected]> wrote:

However you need to be a little bit careful. In your
example, you gave foo a scaler value. If, OTOH, you had said
  foo: { bar : 1 }
then the object is created only once and you get a reference to it in each
instance. If one instance does this.getFoo().bar = 23; then it will be 23 in
all instances, because they are referencing the same object. If you need
objects as member variables, the proper way to do it is to set
  foo: null
in the member section, and then initialize it to a new object in the
constructor.

-- 
View this message in context: 
http://www.nabble.com/Exact-meaning-of-member-attributes-tp25776434p25777023.html
Sent from the qooxdoo-devel mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to