Agreed on all points, but when the deadline is approaching and the code needs to be done...
Ironically to your points, I'm relatively new to Flash (~2 months), and have come to this language from C, C++, and Java. It's been *far* more difficult to learn than I expected, in many cases due to the "hacks" you mentioned. ("Whaddya' mean 'this' doesn't refer to the class instance when you're in a callback function _that's_a_method_of_the_class_!?!") That said, I'm a pragmatist when it comes to finishing a project. :-] -Chris -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of JesterXL Sent: Friday, November 11, 2005 1:51 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] Singleton in AS3 That's fine for use Flashers who are used to using such methods to get what we want. However, other languages are more strict, and from the perception of new programmers coming into ActionScript 3, not meeting their expectations is a failure of the language... to point. Bottom line, they see our "methods" as "hacks", and that's a bad thing. The correct way is to use getInstance, yes. But, it should also throw an exception if you try to instantiate it: var a:MyClass = new MyClass(); That should not work, but it does currently because you have no choice. In an effort to make ActionScript more clean, strict, and helpful, this is one of the additions. The language itself should be self-explanatory to use it, and should support common programming patterns such as Singleton. Supporting design patterns in a language, to me is iffy, but there are a enough business use cases in my opinion to support it. ----- Original Message ----- From: "Chris Wilson" <[EMAIL PROTECTED]> To: "'Flashcoders mailing list'" <flashcoders@chattyfig.figleaf.com> Sent: Friday, November 11, 2005 1:40 PM Subject: RE: [Flashcoders] Singleton in AS3 Why should a public constructor prevent the creation of a Singleton? All you need is a static getInstance() method and a private attribute to hold the created instance. Sure, the public constructor means someone else could instantiate the class on their own without using getInstance(), but if you're writing the code, you'll do it the proper way anyhow, no? -Chris -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of JesterXL Sent: Friday, November 11, 2005 1:32 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] Singleton in AS3 You can't yet as for the reason you stated. Bitch on the forums pretty please; you, many many others, and I all want this changed. http://www.macromedia.com/cfusion/webforums/forum/categories.cfm?catid=587&e ntercat=y ----- Original Message ----- From: "Michael Klishin" <[EMAIL PROTECTED]> To: "Flashcoders ML" <flashcoders@chattyfig.figleaf.com> Sent: Thursday, November 10, 2005 12:16 PM Subject: [Flashcoders] Singleton in AS3 Hi guys, Have anyone got ideas how to implement Singleton pattern in AS3 best? Constructor in AS3 can only be public or internal, which is not private anyway. .. -- Michael "Antares" Klishin, Email: [EMAIL PROTECTED] Web: www.novemberain.com Non progredi est regredi _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders