Need feedback on simple idea

Adam Spitz aspitz at student.math.uwaterloo.ca
Fri Apr 11 16:02:14 UTC 2003


Tim Rowledge wrote:

> On a more practical point, the idea of using self-like messages to 
> define instance variables would be acceptable IFF those messages were 
> properly private. In order to provide this privacy one would need to 
> implement some mechanism to allow properly private methods and the same 
> mechanism would (very likely) solve the worries about overly public 
> methods already in the system. I'd be quite happy to see such a privacy 
> mechanism if anyone has good ideas.

I don't have any *good* ideas. :) But here's what someone else did:

The Ruby language allows "self" to be left out when it's the receiver
(just as Java and Self do). Ruby also has a simple privacy mechanism:
you can mark a method as being private, and private methods can only be
accessed by messages sent using the "implicit self" syntax. (Is that
right? My Ruby is rusty.)

It's an ugly hack in a lot of ways, and I don't really mean it as a
serious suggestion. (I'd really like to hear more about Nathanael's
idea.) It shows, though, that it's possible to have a very simple rule
that would give us the same kind of privacy as we have for our instance
variables right now.


Adam Spitz



More information about the Squeak-dev mailing list