AOP Compatibility

Brendan Eich brendan at
Wed Feb 20 15:52:37 PST 2008

On Feb 20, 2008, at 3:42 PM, Kris Zyp wrote:

>> I thought the question was about annotating class fixtures?
> Yes, that was my intent, sorry I wasn't clearer.

No problem, sorry for assuming you meant ES3-compatible code.

> I knew that built-ins were
> designed to be backwards compatible. I don't have the RI in front  
> of me at
> the moment, but I assume you can't do replace a method on a user  
> class with
> another ad-hoc function.

Absolutely not with fixtures, but you can put the prototype qualifier  
in front of function definitions in classes to create prototype  
methods just like the ones in ES3's builtins, and you can make your  
class dynamic (although IIRC, all class objects where static  
properties live are mutable; class *instances* are fixed unless the  
class is dynamic -- Graydon or Jeff should correct me if I'm wrong).  
If you want to allow AOP, which is pretty much an integrity  
violation, you have to lower your shields.

Formalizing AOP further, somehow supporting it without losing the  
integrity guarantees needed for early binding and strict mode, is out  
of scope for ES4. But you can do a lot with ES4's function types. If  
the guarantee is not about function object identity (e.g. for  
analysis of effects, or for inlining), rather only about function  
type, it's fine to use a non-fixture that has a type annotation. | 
prototype function AOPmeHarder(this:Widget, a:int, b:string):boolean|  
can be overwritten by advice, but the advice can't subvert type  


More information about the Es4-discuss mailing list