The official rationale can be found in Chapter 9 of the latest draft 
specification of ECMAScript 4th edition:

<quote>
Rationale: making a constructor always public reinforces the user model of 
classes, like functions, as constructors. While other languages allow 
constructors methods to be made inaccessible to keep outside code from creating 
instances, this use case was not deemed important enough to complicate the 
language design. It is a compatible change to allow explicit access control 
namespace attributes in a later edition.
</quote>

The entire draft specification can be found online at the Mozilla website:

http://developer.mozilla.org/es4/

If you are wondering why it would complicate the language design, my 
understanding is that the complication stems from ECMAScript's treatment of 
class objects and constructor methods. As one engineer described it to me, 
ECMAScript blurs the distinction between the two. Consequently, allowing access 
specifiers other than public on a constructor would require changes to the 
object model. This would have to be done carefully in order to preserve 
backward compatibility.

If you feel that private constructors are an important language feature, please 
add a feature request on the Adobe feature request/bug report form:

http://www.adobe.com/support/email/wishform

Francis

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:flashcoders-
> [EMAIL PROTECTED] On Behalf Of Mike
> Sent: Tuesday, July 11, 2006 11:45 AM
> To: 'Flashcoders mailing list'
> Subject: RE: [Flashcoders] Abstract classes in AS3?
> 
> That does seem stupid and completely pointless. I use private
> constructors all the time.
> 
> Is there an official rationale for this?
> --
> T. Michael Keesey
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Cédric
> Néhémie
> Sent: Tuesday, July 11, 2006 11:30 AM
> To: Flashcoders mailing list
> Subject: Re: [Flashcoders] Abstract classes in AS3?
> 
> Chris, from the latest AS3 Language Reference
> (http://livedocs.macromedia.com/flex/2/langref/index.html), in
> compile-time errors section :
> 
> 1153 - A constructor can only be declared public
> 
> I don't understand why Adobe do that ? If somebody have an idea, I'ld be
> buyer  ?
> 
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> 
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to