Skip navigation
dimumurray
Currently Being Moderated

Why is it that AS3 does not support private constructors as AS2 does?

May 19, 2008 9:13 AM

Why is it that AS3 does not support private constructors as AS2 does?

Private constructors are standard in most OOP languages (for example
C++ and Java) and were supported in Actionscript 2. However, this is
not the case in AS3 which only allows its constructors to have the
'public' access modifier.

I have legacy code that I hope to migrate to the AS3 platform. Some
key elements of my code rely on design patterns like the Singleton
pattern which in turn depend on private constructors. I could refactor
my code but, ultimately, I would lose the benefits of the pattern
(ie. one and only one instance of the Singleton class).

I have also used private constructors to simulate enumerated types
much like the enums you would find in Java 5 and up. But I can't
use the same implementation in AS3 without private constructors.

I do not want to resort to mixing legacy code with new AS3 code to
keep functionality intact. Are there any possible work-arounds for
this issue?

If not, are there any lobbying groups I need to know about so that
we can get this feature back?
 
Replies

More Like This

  • Retrieving data ...

Bookmarked By (0)