The standard does *not* support - a removeAll: a - [was: Re:
[BUG]
Stephan Rudlof
sr at evolgo.de
Sat Aug 31 15:51:36 UTC 2002
Jesse Welton wrote:
> Stephan Rudlof wrote:
>
>>[...]
>>Since we have an 'uncaptured' parameter, the receiver *has* *to* never
>>retain a reference to the parameter, directly or indirectly, as a result of
>>this message.
>>
>>Further: The parameter *is* the receiver in the case of
>> a removeAll: a
>>. Has this receiver a direct reference to itself? I don't think so.
>>But the *coupling* between receiver and parameter here is much stronger -
>>identity! - than a mere reference. And the intent of the requirement here -
>>as *I* read the standard - has been to have *no* coupling between parameter
>>and receiver here.
>
>
> This interpretation is clearly unreasonable. I can see how one might
> reasonably interpret the identity coupling as a sort of indirect
> reference (though I suspect that what is meant instead is a reference
> chain),
> but you're ignoring the very important clause, "as a result of
> this message." This coupling is not a result of the message at all.
This is true: I've overlooked that.
> Furthermore, consider the following:
>
> a := OrderedCollection with: 1.
> b := OrderedCollection with: 1 with: a.
> b removeAll: a.
>
> I would certainly hope that any reasonable programmer would consider
> this perfectly sensible, and should remove 1 from b, leaving it with
> the single element a. This is a direct reference that your reading of
> the standard would require to be illegal. Fortunately, since it is
> clear that this reference is not a result of sending #removeAll:, it
> is, in fact, permitted by the standard.
Good example.
Thank you for the correction.
Greetings,
Stephan
<snipped>
--
Stephan Rudlof (sr at evolgo.de)
"Genius doesn't work on an assembly line basis.
You can't simply say, 'Today I will be brilliant.'"
-- Kirk, "The Ultimate Computer", stardate 4731.3
More information about the Squeak-dev
mailing list
|