ES4 draft meta-issues

Brendan Eich brendan at
Wed Feb 27 10:18:36 PST 2008

On Feb 27, 2008, at 9:00 AM, Lars Hansen wrote:

> Meta-level methods
> The predefined namespace "meta" is used for methods that  
> participate in
> language-level protocols: invocation and property access and  
> update.  A
> class that defines meta::invoke is callable as a function (the
> meta::invoke method is invoked in response to the call); the  
> meta::get,
> meta::set, meta::has, and meta::delete methods are invoked in response
> to accesses to non-fixture properties on the object.

Pedantry alert, forgive me -- but it may be important to know that  
meta::invoke has static and instance forms.

Given class C { ... meta static function invoke(...) ... }, you can  
call C as a function:

   x = y + C(z);

This is used, e.g., by class Date in builtins/

If you define a non-static function (a method) named meta::invoke  
(via class C { ... meta function invoke(...) ... }), then as with  
meta::get, etc., it is the instances of C that are themselves callable:

   c = new C;
   x = y + c(z);

So there's a meta function invoke(...) ... in class Function in the  
RI's builtins/, for example.



More information about the Es4-discuss mailing list