This is very interesting to me. I don't know how that all works in a real-case 
scenario yet, but I will. ;)
When I get into design patterns I think I may revisit this post.
Thanks Kevin.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com



On May 21, 2013, at 5:51 PM, Kevin Newman wrote:

> Why? The answer has to do with Adobe's adherence to the ECMAScript working 
> standard that they were basing AS3 on. At the time (before the ECMAScript 4 
> process fell apart), the body determined that private constructors were not 
> needed, so adobe built this restriction into AS3.
> 
> Private constructors aren't useless, particularly for single pattern. With a 
> private constructor, you can instantiate the class from within itself, assign 
> it to a private class (static) property, and then expose the single instance 
> through a public class (static) getter function. You'd be protected from 
> every other way to instantiate the class. There are ways to do singleton 
> without it, they are just more of a pain. Like taking an instance of a key 
> class in the constructor, where the Key class is defined in the local class 
> file scope chain. Since nothing else will have access to that Key class 
> except your singleton class, you can use that as a nice locking mechanism.
> 
> I can't think of any use for private class off the top of my head, but that 
> doesn't mean there isn't one.
> 
> Kevin N.
> 
> 
> On 5/21/13 2:39 AM, Cor wrote:
>> Karl,
>> 
>> One: why doesn't ActionScript 3 allow private classes?
>> A: They are useless because they couldn't be used, I guess.
>> You can use a Class within a public class which then would be private to
>> that class it self.
>> 
>> Two: why is writing "public class" a best practice if "private class" does
>> not exist?
>> Look a the variations with static etc.
>> 
>> HTH
>> Cor
>> 
>> 
>> 
>> 
>> _______________________________________________
>> 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