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/Date.es.
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/Function.es, for example.
HTH,
/be
_______________________________________________
Es4-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es4-discuss