[self-interest] A question about Self encapsulation

Russell Allen mail at russell-allen.com
Thu Dec 17 10:58:30 UTC 2009

Hi Takuro,

I'm not sure myself why public and private were dropped; maybe someone else on the list can help out.  Jecel seems to be the resident Self historian?

Self, at least at the moment, doesn't care much about security.  For example, mirrors can easily be obtained on almost any object.  If you can get a mirror, there is little you can't do with an object.

I'm not sure, however, that Self style delegation is of itself a security problem.  I can see how it *would* be if there were still private and public slots - inheriting from an object would be a way to access its private slots.

But since Self doesn't have private slots, there wouldn't seem to be much that an inheriting object could do that a normal object couldn't.

Take a BankAccount object for example:

(| total <- 0.  
   deposit: x = (total: total + x). 
   withdraw: x = (x < total ifTrue: [total: total - x]) 

Sure I could inherit from it and send messages to myself that would affect it; but I could also just send it the message "total: 1000000" for instant wealth :)

Some security could be obtained by renaming the 'total' slot something unguessable; but the feature of Self that breaks that isn't inheritance but getting a mirror on the object to see what the slots are named.

Maybe if private slots were reintroduced then restrictions on who can inherit from an object would need to be introduced as well.  

- Russell

On 16/12/2009, at 4:28 PM, takuro ikejiri wrote:

> Hi all,
> I am a university student and interested in prototype-base language.
> I have a question:
> http://research.sun.com/self/release_4.0/Self-4.0/Tutorial/Language/FinishingTouches/FinishingTouches.html
> according to this page,
> "The distinction between public and private is purely for documentation.
> Earlier versions of Self enforced privacy (allowing only sends to self
> to locate private slots) but this scheme was found to be unworkable."
> My question is "what is unworkable about Self encapsulation ?".
> I also read a paper ( parents are shared parts of objects:
> Inheritance and encapsulation in SELF,1991),
> and learned about inheritance-based encapsulation.
> I think this approach is not good because an encapsulated module
> cannot prohibit access from outside
> (because an object gain access to the module by becoming a child of
> the module).
> I'd appreciate it if you could answer this question.
> Thanks in advance.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.selflanguage.org/pipermail/self-interest/attachments/20091217/b7005ab8/attachment.html>

More information about the Self-interest mailing list