[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnash-commit] gnash ChangeLog server/asobj/Number.cpp testsui...
From: |
zou lunkai |
Subject: |
Re: [Gnash-commit] gnash ChangeLog server/asobj/Number.cpp testsui... |
Date: |
Mon, 26 Mar 2007 10:20:06 +0800 |
On 3/25/07, Sandro Santilli <address@hidden> wrote:
On Fri, Mar 23, 2007 at 05:47:13PM +0800, zou lunkai wrote:
> >>check_equals(typeof(Number.valueOf()), 'function'); // this is odd
> maybe a Ming bug?
I think it makes sense looking at ECMA-262 specs:
The "primitive" value of a constructor is still a 'function'.
What's the "primitive" value mean here?
From ECMA-262, 4.3.2:
A primitive value is member of one of the types Undefined, Null,
Boolean, Number, or String.
4.3.4:
A constructor is a Function object that creates and initialises objects.
> typeof(Number.prototype.valueOf()) == undefined here!
It's likely inherited from Function:
Number.__proto__.valueOf()
This is illegal expression to me. And also Number.valueOf or Number.valueOf().
The reason for this is that the "valueOf" is a property of
Number.prototype(15.7.4.4). We can not access it directly. Notice that
the Number constuctor does not have a "__proto__" property(15.7.3).
And with Ming compiler, the following results are confusing all together:
trace(typeof(Number.valueOf())); //output: function;
trace(typeof(Number.__proto__.valueOf())) //output: object;
trace(typeof(Number.protoype.valueOf())); //output : undefined;