Behaviors vs Modules

Anthony Hannan ajh18 at cornell.edu
Sat Feb 23 17:20:49 UTC 2002


Jecel Assumpcao Jr <jecel at merlintec.com> wrote:
> On Friday 22 February 2002 23:38, Anthony Hannan wrote:
> > - A Smalltalk expression now knows, via the selectors it calls, which
> > protocols and corresponding default behaviors it depends on.  So
> > starting from a Smalltalk expression we can trace selectors and
> > methods recursively and load all default behaviors that will be
> > needed.
> 
> Two slight problems:
> 
>   1) #perform:

perform: will have to take a selector object that already knows its
protocol instead of just a symbol.  The selector's protocol will be loaded 
at runtime when the perform is triggered.

>   2) if #foo is used in only one protocol in your system, you don't 
> have to say which one that is, right? Now imagine that you send your 
> module to me and I load it into my system which also has a #foo in only 
> one protocol, but it happens to be a different protocol from yours!

The compiled method will have the selector object "foo" in its literals
which knows its protocol, not the symbol #foo.  So if you send the
compiled method to another image (via image segments) then the protocol
will go with it.  If you just send the source code, your right, "foo"
will be looked up in the new environment.  But this is the same problem
we have with globals now.  How do I know "String" in my image means the
same as "String" in your image?

Cheers,
Anthony



More information about the Squeak-dev mailing list