ES4 draft: Function

Waldemar Horwat waldemar at google.com
Thu Mar 13 15:01:01 PDT 2008


Here are my comments on this section:


> static public function apply(fn /*: function*/, thisArg: Object=null, argArray: Object=null)
> static public function bind(method /*: function*/, thisObj: Object=null, ...args)
> static public function call(fn /*: function*/, thisObj: Object=null, ...args)
> prototype function apply(/*this: function, */ thisArg=undefined, argArray=undefined)
> prototype function bind(/*this: function, */ thisObj=undefined, ...args)
> prototype function call(/*this: function, */ thisObj=undefined, ...args)

What does "/*: function*/" mean here?  Are these arguments required to have the function type or not?


Although apply is redundant in the presence of the splat operator, I see no harm in keeping it for consistency with ES3.


> *Implementation*
> 
> The implementation of the meta function |invoke| is 
> implementation-dependent.

Omit the implementation section altogether.  Saying "implementation-dependent" is misleading here, as its behavior should not be implementation-dependent.


> intrinsic function apply(thisArg: Object=null, argArray: Object=null)
>     Function.apply(this, thisArg, argArray);

> intrinsic function bind(thisObj: Object=null, ...args)
>     Function.helper::bind(this, thisObj, args);

> intrinsic function call(thisObj: Object=null, ...args)
>     Function.apply(this, thisObj, args);

The middle one is not like the other two.  Hmmm....  another use case for the splat operator.


    Waldemar



More information about the Es4-discuss mailing list