Scoped binding of a method to an object

Brendan Eich brendan at mozilla.com
Mon Oct 14 11:44:48 PDT 2013


> Allen Wirfs-Brock <mailto:allen at wirfs-brock.com>
> October 14, 2013 11:19 AM
>
> You can dynamically change the superclass of a class but that will 
> trigger the recompilation process for that class and its subclasses 
> (implies that superclass to subclass links must be available). This is 
> mostly about the instance variable (ie, private state) shape of the 
> instances and methods that reference instance variable.

This is metaprogramming magic I never learned (my Smalltalk experience 
was brief: Byte mag, homebrew Pascal impl I never finished, then the 
real deal on Sun "pizza box" machines in '84 or so at UIUC -- 
slooooowwwww!). Any pointers welcome.

Good to see JS is no more dynamic than Smalltalk in this regard. Not 
sure we can standardize the recompilation process, or that we need to. 
We just need the implementors to take that hit, and they have already 
for prototype-chain updates (most VMs deoptimize horribly; some may 
poison the object for the rest of its life to be slow-path only; this 
could change under competitive pressure, but devs avoid slow paths).

> Methods lookups are still dynamic which is the reason I think "nominal 
> class types" a la Java or C# doesn't really apply.

Granted, Smalltalk is dynamically typed as noted (and <3ed by JS'ers 
everywhere :-).

/be



More information about the es-discuss mailing list