Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!husc6!bu-cs!buengc!art From: art@buengc.BU.EDU (A. R. Thompson) Newsgroups: comp.lang.pascal Subject: Re: Multiple function-values (was: Re: The gaping hole left by var parameters ...) Message-ID: <347@buengc.BU.EDU> Date: 30 May 88 17:29:48 GMT References: <5879@uwmcsd1.UUCP> <3499@omepd> <5915@uwmcsd1.UUCP> <3854@diku.dk> Reply-To: art@buengc.bu.edu (A. R. Thompson) Followup-To: comp.lang.pascal Organization: Boston Univ. Col. of Eng. Lines: 24 In article <3854@diku.dk> damm@diku.dk (Kristian Damm Jensen) writes: >In article <5915@uwmcsd1.UUCP> markh@csd4.milw.wisc.edu (Mark William Hopkins) writes: >>In article <3499@omepd> bobdi@omepd.UUCP (Bob Dietrich) writes: > << stuf deleted >> >>You have a point on one matter: as long a Pascal does not allow files-as-values >>side-effects must occur be allowed in functions. Also, as long as Pascal does >>not allow the one to construct functions that can return MULTIPLE values, one >>will need to write procedures with var parameters in their stead. > >This is not correct. A way to overcome this problem is to put those >multiple values in a record, and let the function return a pointer to >the record. Agreed, this doesn't seem very elegant, but it works, an you Wrong. The result of the function is the pointer, not the record. The pointer is a single value of a simple type. Actually, functions that have structured types as a result type are to become part of the new Pascal standard due out soon. When? The Oregon Software Pascal compiler, which I use as the Encore Pascal-2 compiler, does indeed allow structured types as the result types of functions. I can attest that this is quite handy, and makes good logical sense to boot. Rest deleted.