[Modules] A proposal for Modules, Packages and Dependencies

Joshua 'Schwa' Gargus schwa at cc.gatech.edu
Wed Aug 22 13:19:57 UTC 2001


On Wed, Aug 22, 2001 at 08:32:53PM +1000, Russell Allen wrote:
> "Les Tyrrell" <tyrrell at iserve11.lis.uiuc.edu> wrote:
> > We do not give classes explicit information about other classes - we do not force them to import method selectors from other explicitly named classes before they can operate. 
> 
> How is this different from inheritance?  Before my class String can
> operate, it must import method selectors from the class
> ArrayedCollection, 

Well, not necessarily.  Another way to look at it is that if a Class
cannot find a method for a selector, it passes it off to its
superclass.  From a conceptual view (ie: disregarding implementation
details such as polymorphic inline caching of methods) the Class never
asks whether its superclass contains a method corresponding to a
selector.  For example, I can compile a method in MyClass that
contains the code "self selectorForWhichMethodLookupWillFail", where
sFWMLWF is a selector for some method in the system, but is found in
MyClass' hierarchy.

Smalltalk is largely based on the principle of late binding.  One
example is the fact that the compiler does not check that methods
exist for all messages sent to self.  Enforcing module prerequisites
at module load time is basically early binding.  Since late binding 
is arguably one of the main factors that makes Smalltalk as wonderful
as it is, we should very carefully weigh the pros and cons before
making deep system changes that do not follow this principle.

I'll leave the enumeration of pros and cons as an exercise to the
reader ;-)

> which must be explicitly named.  

This is true.  I guess its a little bit fuzzy.  However, this could
simply be a side-effect of Smalltalk's programming environment design.
As a user of Smalltalk (as opposed to a low-level hacker working on
Proxies, etc.), I will almost never create a class without a
superclass.  Therefore, the standard way to create a class involves
providing the name of the superclass.  However, you can also create a
class by starting with "Class new" and going from there.  It's more of
an accepted way of doing things rather than an enforced prerequisite.

Joshua


> Everytime I file in
> a change set, I am filing in a list of classes, all of which have
> explicitly named prerequisites; if the prerequisite is not there then
> the process breaks...
> 
> Russell
> 
> ----------------------------------------
> Russell Allen
> 
> russell.allen at firebirdmedia.com
> 
> ----------------------------------------
> 




More information about the Squeak-dev mailing list