Newsgroups: comp.lang.eiffel Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!sdd.hp.com!wuarchive!uunet!stanford.edu!leland.Stanford.EDU!leland.Stanford.EDU!craig From: craig@leland.Stanford.EDU (Craig Chambers) Subject: Re: Functions without side effects (was Old confusion) Message-ID: <1991May30.195249.16103@leland.Stanford.EDU> Sender: news@leland.Stanford.EDU (Mr News) Reply-To: craig@self.stanford.edu Organization: Stanford University References: <1991May30.141218.3446@mstr.hgc.edu> Date: Thu, 30 May 91 19:52:49 GMT Lines: 16 In article <1991May30.141218.3446@mstr.hgc.edu>, jcm@mstr.hgc.edu (James McKim) writes: |> The point is pop and top are independently useful and so deserve to be separated. I agree; I never meant to suggest that Top shouldn't exist. |> And this independent usefulness comes about precisely because one changes |> the state and the other merely queries. No, my Stack class would have a Top method that returned the top of the stack and a Pop method that both removed the top element from the stack *and returned this element to me*. Since I don't follow any dogma stating that procedures should not return values, I make my procedures be as helpful as possible, in this case by also returning what the top of the stack was. -- Craig Chambers