Squid Environments

Anthony Hannan ajh18 at cornell.edu
Tue May 6 00:17:34 UTC 2003


Well after thinking some more I noticed some opportunities for
improvement on my environments design.  Here they are (I hope you guys
don't mind all my thinking out loud, and changing my mind).

Method name prefixes (protocol part) aren't needed anymore since the
environment can serve as the protocol.  If two methods from different
inherited environments have the same name then the inheriting
environment must alias them.  Calling methods will never need to provide
selector prefixes anymore since aliasing will resolve conflicts.

When an independent (protocol) method delegates to the receiver class,
where does it look for the class's method?  We can't just say in the
class method dictionary because that dictionary changes depending on
which environment you are looking from.  So which environment do you
search when you delegate?  We can't use the execution environment since
dynamic binding violates encapsulation and security.  We can't use the
environment the protocol method is defined because the receiver class
may be defined in a higher environment not giving it an opportunity to
override.  We can't use the environment the class is defined in since
the class extension may be defined in an higher environment with the
protocol method or orginal sender.  The solution is to look in both the
original sender's environment and the class's environment.  The original
sender's environment will necessarily include the protocol environment
since it is calling it.  Both environments are searched as if they were
both inherited by some environment, meaning an error is raised if a
conflict exists (in a normal environment an alias would resolve the
conflict).

This is similar to ClassBoxes, and I have kind of come full circle to
it.  But I am still not sure which environment/classbox Alexandre
searches when looking up methods for a class.  I think he searches the
execution environment/classbox, which although convenient, violates (I
believe) environment modularity (encapsulation) and capability security.

Cheers,
Anthony



More information about the Squeak-dev mailing list