Argument unpacking?

Brendan Eich brendan at mozilla.org
Thu Nov 9 14:47:00 PST 2006


On Nov 9, 2006, at 2:19 PM, P T Withington wrote:

> On 2006-11-09, at 16:29 EST, Brendan Eich wrote:
>
>> It would also be helpful for bootstrapping if new and apply could  
>> be composed; this came up when I wrote Narcissus.  Suggestions?
>
> Make new a class method rather than a keyword?  (I know, too  
> controversial.  But that is the Lisp answer.)

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).  Is this what you mean?

/be



More information about the Es4-discuss mailing list