Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!mcsun!unido!laura!owl!huba From: huba@ls5.informatik.uni-dortmund.de (Hubert Baumeister) Newsgroups: comp.lang.smalltalk Subject: Re: PP Smalltalk R4 Query, Bug? Keywords: help Message-ID: <3086@laura.UUCP> Date: 8 Mar 91 15:22:18 GMT References: <4931@goanna.cs.rmit.oz.au> <1991Mar8.140425.10863@m.cs.uiuc.edu> Sender: news@laura.UUCP Reply-To: huba@ls5.informatik.uni-dortmund.de (Hubert Baumeister) Organization: University of Dortmund, Germany Lines: 32 In article <1991Mar8.140425.10863@m.cs.uiuc.edu>, johnson@cs.uiuc.EDU (Ralph Johnson) writes: ... |> These expressions have always been different, because |> the add: messages for collections always returns the |> argument, not the receiver. Lot of people think that |> this is a design bug, but there *is* a reason for it. |> |> The reason is because of cascaded messaged. |> aCollection add: thing1; |> add: thing2; |> add: thing3 |> will only work if add: returns the receiver. |> Ralph, I do not understand your example. These cascaded messages work independend of the result of the add: message. On the other hand if you used the expression ((aCollection add: thing1) add: thing2) add: thing3 then this would require that add: returns the receiver. To overcome the problem that add: returns the argument, one can allways use yourself to get the collection back like in: aCollection := Collection new add: thing1; add: thing2; add: thing3; yourself. |> Ralph Johnson -- University of Illinois at Urbana-Champaign Hubert Baumeister (huba@ls5.informatik.uni-dortmund.de)