Need feedback on simple idea
Nathanael Schärli
n.schaerli at gmx.net
Fri Apr 11 20:22:29 UTC 2003
Adam,
> 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.
I absolutely agree with you. The main goal is to have a *simple* and
*uniform* mechanism that addresses the dynamic nature of Smalltalk.
- Simple means that it should be easy to use and understand.
- Uniform means that it should be applicable to both state and behavior.
As I pointed out in my earlier post, it's not worth anything if we have
a mechanism that only allows one to declare encapsulated state, but not
encapsulated methods. And because I don't like the idea of having
different encapsulation mechanisms for methods and state, I suggest a
uniform mechanism.
> I'd really like to hear more about Nathanael's idea.
I'll post more about that as soon as I have some more time to really
work on this (probably in a couple weeks). Then, I'll also be very
interested in hearing more opinions and comments from the list. Finally,
ideas are not born perfect ;)
Thanks,
Nathanael
> -----Original Message-----
> From: squeak-dev-bounces at lists.squeakfoundation.org
> [mailto:squeak-dev-bounces at lists.squeakfoundation.org] On
> Behalf Of Adam Spitz
> Sent: Freitag, 11. April 2003 18:02
> To: The general-purpose Squeak developers list
> Subject: Re: Need feedback on simple idea
>
>
> 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
|