Pipe syntax and the current methods
bert at freudenbergs.de
Tue Aug 28 00:39:19 UTC 2007
On Aug 27, 2007, at 16:08 , Alan Lovejoy wrote:
> Blake wrote:
>> b := a msg.
>> b msg1.
>> b msg2.
>> Do I misunderstand? (And at what point does the potential for
>> confusion and ambiguity outweigh the feature?)
> The message sent to a is #asPipe, not msg:
> p := a asPipe.
> p msg.
> p msg1.
> p msg2
> Or alternatively:
> a asPipe
> The Pipe arranges for each message to be sent to the right object.
and it does so by retaining the previous value inside the Pipe
object, so this is equivalent to
p := a asPipe. "p value: a"
p msg. "p value: p value msg"
p msg1. "p value: p value msg1"
p msg2. "p value: p value msg2"
>> (And at what point does the potential for confusion and
>> ambiguity outweigh the feature?)
At the point where this code would leave my machine ... as I said,
I'd not use that in production. In that sense, adding new syntax
actually provides clarity.
Which reminds me - actually spelling this out using a running value
is what I would use in production:
val := a.
val := val msg.
val := val msg1.
val := val msg2.
I use this code pattern sometimes. You couldn't do this in a
statically typed language, but in Smalltalk
- Bert -
More information about the Squeak-dev