From: robert@metropolis.com (Robert Munyer)
Subject: Re: designing an OO language (Was: Re: Yet Another Beginner's
Organization: Metropolis Software, Inc.
Date: Tue, 18 Aug 1992 04:24:01 GMT

In article <SMALK%92081714284200@FINHUTC.HUT.FI> jrade1@GWDGV1.DNET.GWDG.DE
(GWDGV1::JRADE1) writes:

> Robert Munyer <robert@METROPOLIS.COM> writes:

> > [Note to the experts out there:  I am designing an OO language that does
> > not have this feature -- variables can be used as messages, in which case
> > the value of the variable determines which message will be sent.  Do you
> > think I am making a mistake?  Is there something I don't know about that
> > will bite me?]

> I wouldn't term myself an OO-expert, but from what I've learned through
> previous postings to this newsgroup, your design would make all instance
> variables of your classes accessible to all other code. This would
> contradict the objective of encapsulation. ST uses explicit coded messages
> to access instance variables instead. A workaround would be using import/
> export restrictions. But then your original intentions are not met?
> I'm not quite shure wether I understood you right, what do you exactly mean
> by "the value of the variable determines which message will be sent"?

You are missing the point.  (My fault, I'm sure, for not explaining it
better).  I will try to explain it better this time:

When I said, "variables can be used as messages, in which case the value of
the variable determines which message will be sent", I meant that you could
do something like this:

	| anArray abc:def: |
	    abc:def: := at:put: .
	    anArray := #(1 2 3 4) copy .
	    anArray abc: 3 def: #three .
	    anArray

which would return

	(1 2 three 4)

In this example, a message would be a separate kind of object, distinct from
a symbol.  "at:put:" would be just a global variable, whose value is "factory
installed" to be a particular message.  "abc:def:" is a temporary variable,
and its value is set to be the same as that of "at:put:".  Any kind of
variable -- global, temporary, parameter, class, or instance -- could have a
message as its value.  Any place that you would ordinarily pass around the
name of a message as a symbol, you would instead pass the message itself.
"perform:" would be pretty much obsolete.

Note: I'm actually not going to use a Smalltalk-like syntax.  I wrote the
example above in Smalltalk style just to make it more convenient for readers
of this newsgroup.

Why would I want this feature?  Well, aside from the fact that I like the
idea of treating messages as real objects, I am hoping to provide the ability
to localize messages into specific modules.

For example, one programmer could define a message "foo:bar:", and have it be
accessible only from within the module he is working on.  Another programmer 
could define a completely different message with exactly the same name, but
in a different module.  The two modules could then be merged into one program
without any conflict -- each module has its own "module level" variable named
"foo:bar:", and these two variables have two completely different "message
objects" as their values.

Comments, anyone?

______________________________________________________________________
Robert Munyer            |   "I may be synthetic, but I'm not stupid."
robert@metropolis.com    |      -- Bishop, _Aliens_