Argument unpacking?

Brendan Eich brendan at mozilla.org
Thu Nov 9 15:04:12 PST 2006


On Nov 9, 2006, at 2:54 PM, Brendan Eich wrote:

> On Nov 9, 2006, at 2:47 PM, Brendan Eich wrote:
>
>> We could expose intrinsic::construct as the meta-object protocol  
>> hook underlying new, and allow you to write, e.g.:
>>
>>   class Complex! {
>>     static intrinsic function construct(real:double,  
>> imag:double):Complex {...}
>>     . . .
>>   }
>>
>> Then you could always invoke 'Complex.intrinsic::construct.apply 
>> (Complex, args)' where args is [real, imag]. Or something simpler  
>> to write (static intrinsic function my summer vacation was very  
>> nice ;-), but this example is in keeping with the proposed call  
>> hook (https://intranet.mozilla.org/ECMA/wiki/doku.php? 
>> id=proposals:builtin_classes).
>
> I see in https://intranet.mozilla.org/ECMA/wiki/doku.php? 
> id=proposals:builtin_classes (the Object class at least) a 'static  
> function new

Sorry for the private links.  See http://developer.mozilla.org/es4/ 
proposals/builtin_classes of course.

> Object() {...}'.  This is, I think, obsolete syntax -- we do not  
> want to require the class name to be restated after 'new' or  
> 'call'.  It may be that we agreed to use 'construct', not 'new', as  
> the MOP hook name, since 'new' is reserved and we don't want to  
> outlaw direct calls of the static method.

"... we don't want to outlaw explicit calls [and apply's]", I should  
have written.  The whole point is that you can invoke  
C.intrinsic::construct directly or indirectly via .apply/.call, of  
course (direct/indirect != explicit/implicit).  The implicit call to  
intrinsic::construct via operator new could call any old hook-name.

BTW, we use the intrinsic namespace to avoid __call__ or  
__construct__ style mangled names while providing early-binding  
opportunities to optimizing implementations, without colliding with  
existing plain-named 'call' or 'construct' ad-hoc properties in the  
installed base.

/be



More information about the Es4-discuss mailing list