categorizing traits objects

Urs Hoelzle urs at cs.stanford.edu
Fri Oct 8 17:09:34 UTC 1993


> >   1. Privacy is no longer supported by the VM. Thus, the slot found by
> >      a message lookup is not affected by the privacy declarations. The
> >      declarations are still used for documentation. At some point, we
> >      have plans to support privacy via slot renaming with support from
> >      the programming environment.
> 
> Ohhhh... NO!!! I think one of the major advantages of Self compared with
> Smalltalk is the possibillity to define private slots. Looking at Digitalk's
> Smalltalk/V you can find a lot of methods with comment "Private", even though
> you _must_ use them - what Digitalk does, too! This tells me that if privacy
> declaration is just a comment, people don't "waste" their time thinking
> about what really had to be set private or public. :-(
> 
> Even if public / private - declaration makes reading / debugging code
> more complicate (I have seen this...) I think it is a good feature for
> developers, especially for developerteams.
> But if using privacy, implementors of objects have to write a good 
> documentation about their public slots - so you don't need to debug the
> private slots to check out what the object's public slots really do...

Privacy is a Good Thing, no doubt about that.  However, we felt that
the current (2.0) privacy semantics didn't do the right thing.  Often,
too many objects had access to "private" slots, and all-to-often we
annotated slots with "_", meaning "I consider it private but had to
make it public to allow access".  In particular, privacy had no notion
of "friend" - collaborating objects that have more access than the
rest of the world but aren't related via inheritance.

So, de facto, privacy often wasn't much more than a comment and
couldn't give you any absolute guarantees about who could invoke
methods.  That's why we converted it into exactly that, a kind of
stylized comment indicating your intention, with "^" meaning "this is
part of the public interface" and "_" meaning "don't send this message
unless you want to be very dependent on my implementation".

This doesn't mean there won't ever be a new privacy scheme.  We have
discussed several possibilities but just haven't settled down on any
particular scheme.  

Hope that helps,

-Urs




More information about the Self-interest mailing list