[e-lang] Faster extends

Dean Tribble e-lang@mail.eros-os.org
Fri, 12 Dec 2003 22:44:40 -0800


In the course of getting things to work in the Squeak implementation, I 
came across things that I improved in the Squeak implementation that 
could perfectly well be improved in the Java implementation.  Here is a 
simple one:

Extends:

the expansion of delegation (in the "extends" construct) should not 
pattern match against the structure of the message.  Delegation expands 
to a match clause that forwards all arguments to super.  Instead of:

...match [verb, args] { E.call(super, verb, args) }

delegation should be defined in terms of a new method (on E) that sends 
an arbitrary object to a receiver.  Then the expansion should just be:

...match msg { E.call(super, msg) }

This change saved about 30% of the time in Chris's code (which uses lots 
of inheritance/delegation).  There's probably some deep seated desire to 
make it difficult to send a non-list as a message, to which my answer 
would be "30%" :-)