In the case of two singletons A,B where an instance of B is created in the constructor of A and the constructor of B needs to have a reference to A it would also be possible to to use A.getInstance(), if A.getInstance() would return the not yet fully constructed A; otherwise a new instance of A would be created, leading to an infinite loop.
I would however prefer to pass 'this' from A to the constructor of B; without arguments X.getInstance() should of course behave as it is now. ibu ----- Original message ----- From: [EMAIL PROTECTED] ([EMAIL PROTECTED]) To: qooxdoo Development <qooxdoo-devel@lists.sourceforge.net> Date: Monday 09 April 2007 08:40 (UTC+1) Subject: [qooxdoo-devel] 0.7-alpha2 singletons: getInstance() arguments > experimenting with 0.7-alpha2 I found that for a singleton > arguments of getInstance() are not passed to the constructor. I'd > appreciate if this would work. > > (Just to eludicate, here is my example: > > I have a Control singleton and a Menu singleton, and from within > Control I'd like to pass 'this' to the constructor of Menu using > > myapp.Menu.getInstance(this); > > Of course, I can use an empty constructor for Menu and have > > var menu = myapp.Menu.getInstance(); > menu.setControl(this); > menu.construct_2_(); > > in Control, but I'd prefer the former.) ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel