[Q] do: ifNotEmpty: ifNotEmptyDo and A proposal for avoiding
many bugs
Richard A. O'Keefe
ok at cs.otago.ac.nz
Mon Dec 6 03:26:06 UTC 2004
"Lic. Edgar J. De Cleene" <edgardec2001 at yahoo.com.ar> wrote:
What you think of replacing.
addAll: aCollection
"Include all the elements of aCollection as the receiver's elements.
Answer
aCollection. Actually, any object responding to #do: can be used as
argument."
aCollection do: [:each | self add: each].
^ aCollection
with:
addAll: aCollection
"Include all the elements of aCollection as the receiver's elements.
Answer
aCollection. Actually, any object responding to #do: can be used as
argument."
aCollection ifNotEmptyDo: [:each | self add: each].
^ aCollection
I tired of fixing this kind or error .
What error? The only error I see there is the one you've just introduced,
where it is no longer true that 'any object responding to #do: can be
used as argument.' What exactly is the problem you are trying to fix?
Or why not have a doSmart: ?
"Evaluate aBlock with each of the receiver's elements as the argument always
argument and element are both not empty or nil"
I cannot understand this comment. All I can figure out for sure from the
wording is that it is a complicated interface which I'm better off without.
More information about the Squeak-dev
mailing list
|