Security by obscurity, while applicable & satisfying pioneers & early 
adopters, is still unacceptable; we need private constructors.

However, you do bring up a good point; I think, non intentionally, the new 
mx framework works like that; like, they use namespaces, in part to support 
namespaces for MXML (I think).

----- Original Message ----- 
From: "Fruber Malcome" <[EMAIL PROTECTED]>
To: "'Flashcoders mailing list'" <flashcoders@chattyfig.figleaf.com>
Sent: Friday, November 11, 2005 10:24 PM
Subject: RE: [Flashcoders] Singleton in AS3


There are many cases where you'd want to ensure that someone can't create a
new instance of a class that you've published.

An interesting workaround is to hide your class in a namespace that is 'not
publicly known', then write a wrapper class that someone can call "NEW" on -
and the constructor of that class checks to see if that object exists.

This doesn't ensure that it doesn't happen, but someone would have to have
intimate knowledge of some unknown namespace in order to create an instance
of that object..

Just an idea.

Thanks - Fruber


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Chris Wilson
Sent: Friday, November 11, 2005 10:40 AM
To: 'Flashcoders mailing list'
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

Reply via email to