Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!rpi!uupsi!grebyn!dlawson From: dlawson@grebyn.com (Drew Lawson) Newsgroups: comp.theory Subject: Re: Procedures with multiple out parameters: why not? Message-ID: <21458@grebyn.com> Date: 16 Aug 90 14:36:08 GMT References: <1990Aug15.231838.5664@zaphod.mps.ohio-state.edu> Reply-To: dlawson@grebyn.UUCP (Drew Lawson) Organization: Grebyn Timesharing, Vienna, VA, USA Lines: 28 In article <1990Aug15.231838.5664@zaphod.mps.ohio-state.edu> vidynath@function.mps.ohio-state.edu (Vidhyarath K Rao) writes: > > >While there is a lot of well-known [i.e. I have heard of them :-^] articles >on the goto statement, I have never seen heard of the theoreticians' case >against having more than one out parameter. None of the reasons I could >think of relates to theory. Can somebody out there give some pointers? > I don't have any references to this, but the attitude I have beed exposed to which agrees with it is that procedures/functions should not both return a value and alter parameters. The problems can be similar to the goto problems: it is less obvious what the flow is (in this case the data flow rather than the control flow). I don't cling too tightly to this rule. Being a C programmer, I make a lot of use of procedures with variable parameters which return a logical value indicating whether the operation was completed correctly. I don't know of any strictly theoretical backing for Dijkstra's assertion, just pragmatic issues. But then, a large part of the problems with gotos is pragmatics. -- +--------------------------------------------------------------------+ | Is life an illusion? | Drew Lawson | | Or does it just seem that way? | dlawson@grebyn.com | +--------------------------------------------------------------------+