inheriting statics

Francis Cheng fcheng at adobe.com
Mon Jan 8 11:29:00 PST 2007


Just to allay Brendan's fears, I can guarantee that this won't be copied
into the ES4 spec. This quote is from the AS3 language reference
documentation for the Object class, and is not from the AS3 language
specification. I'll make sure the Adobe documentation gets fixed.

Francis

-----Original Message-----
From: es4-discuss-admin at mozilla.org
[mailto:es4-discuss-admin at mozilla.org] On Behalf Of Brendan Eich
Sent: Sunday, January 07, 2007 11:40 AM
To: zwetan
Cc: es4-discuss at mozilla.org
Subject: Re: inheriting statics

On Jan 7, 2007, at 11:10 AM, zwetan wrote:

> quoting the doc
> "...
> This property is static in that it is specific to the class or
> function that you create. For example, if you create a class, the
> value of the prototype property is shared by all instances of the
> class and is accessible only as a class property. Instances of your
> class cannot directly access the prototype property.
> "

This seems misleading to me, since the "value of the prototype  
property" is an object that is not shared as if it were a static  
property value. Instead, the properties of the static prototype  
property are visible in all instances, unless overridden  
("shadowed").  So prototype is not an exception to the rule that  
static properties are not inherited by instances -- it's a different  
animal.

Also, function prototypes are not "static" in any sense (the proposed  
Function.apply static method is a class static in ES4; Date.parse is  
a static method in ES1-4; but Function.prototype is the prototype of  
the Function class/constructor -- it's different from f1.prototype  
and f2.prototype for two functions f1 and f2). Function prototypes  
are "instance variables" of each particular function object.

(I'm nit-picking the AS3 doc just so this doesn't get copied into the  
ES4 spec :-/.)

/be

_______________________________________________
Es4-discuss mailing list
Es4-discuss at mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss




More information about the Es4-discuss mailing list