Java's modules rock? (was Re: election details *PLEASE READ*)

Todd Blanchard tblanchard at mac.com
Thu Mar 1 21:55:14 UTC 2007


On Mar 1, 2007, at 2:41 AM, Andreas Raab wrote:
> Well, that's great as long as it is *your* foot. Unfortunately,  
> when modifying a base class that other modules use you are not  
> shooting your own foot - you are shooting the *other* guys foot  
> (since your module will work happily with those modifications but  
> the other modules won't) and that's not okay for a module system.

It seems there have been some attempts at this in Squeak - islands?  
Squeak-E?  I haven't followed them.

I've done more than my share of freaky classloader programming.  The  
best way to think of them is as a hierarchical namespace.  A new  
class loader is a new namespace.  It can reference (but not extend -  
apart from inherit from) things in the parent classloader.

But this is easy given that Java freezes everything at compile time.   
No extensions to anything allowed post-compile (ok - post load).   
Unfortunately, the bar is higher in Smalltalk as we want to allow  
extension of anything.

I don't think it would be conceptually hard to do something similar  
in Smalltalk if you were to have class lookup work similarly to  
method lookup but along namespace hierarchies.  The other thing that  
would make extension safe is a copy on write semantic with class  
wherein extensions to classes that are not local to your namespace  
result in a new class with the same name in your namespace being  
created that derives from the class in the parent namespace.  Thus,  
your mods are kept local to your context.  It does make class binding  
harder as class names have to be resolved dynamically in the methods  
that reference them.

Tricky work I think, but doable if one had the will and the <evil>one  
million dollars</evil> to pay someone to do it. :-)

-Todd Blanchard



More information about the Squeak-dev mailing list