Squeak Modularized (formally Re: Teaching Image)

Anthony Hannan ajh18 at cornell.edu
Fri Mar 14 23:42:44 UTC 2003


Hi Alexandre,

Alexandre Bergel <bergel at asterix.unibe.ch> wrote:
> In the previous months we have come up with a new module system named "Classbox Model". The idea of it is to let people collaborating each other avoiding conflict, but allowing code to be reused and extended. I do not want to describe the model so much here, you could find more explanation on http://scgwiki.iam.unibe.ch:8080/SCG/559

I read your paper.  Nice work.  But it was unclear to me whether
classboxes are dynamically scoped or lexically/statically scoped, i.e.,
are methods looked up starting from the classbox that the initial
expression was executed in, or from the classbox the sending method is
defined in.  The first sentence in section 3.4, "Depending on the
classbox an expression is executed in,...", implies dynamic scope, but
the term "classbox" itself implies lexical scope because classes are
lexically scoped.

Both kinds of scoping have disadvantages.  Dynamic scope has the problem
of violating encapsulation/security.  If your classbox changes #ping:,
not only are your methods that directly call #ping: affected (intended),
but all other methods that call it are also affected (intended or
unintended).  Methods that expect the original code will break if called
indirectly from your code.  And encapsulation says you should not know
what code your code call indirectly.  Lexical scoping solves this
problem because only direct calls are affected which you do know. 
But lexical scoping has the opposite problem of not being able to change
deeply nested behavior that you don't call directly.

I have been struggling with this dynamic vs. lexical scoping for a
while, and I believe a solution should address these concerns, no matter
which scoping you choose.  In my SharedSmalltalk paper at
http://minnow.cc.gatech.edu/squeak/SharedSmalltalk, I choose lexical
scoping for my class extensions because dynamic scoping violates
capability-security/encapsulation.  This limits the ease of
changeability, but is the compromise one has to pay, I think, for safe
sharing.

Cheers,
Anthony



More information about the Squeak-dev mailing list