Re: Multiple return values

steve mcadams <>
20 Apr 1997 12:09:42 -0400

          From comp.compilers

Related articles
[5 earlier articles]
Re: Multiple return values (1997-04-18)
Re: Multiple return values (Mars Saxman) (marssaxman) (1997-04-18)
Re: Multiple return values (1997-04-18)
Re: Multiple return values jbuck@Synopsys.COM (1997-04-18)
Re: Multiple return values (1997-04-20)
Re: Multiple return values danwang@dynamic.CS.Princeton.EDU (1997-04-20)
Re: Multiple return values (steve mcadams) (1997-04-20)
Re: Multiple return values (1997-04-20)
Re: Multiple return values (1997-04-20)
Re: Multiple return values (1997-04-22)
Re: Multiple return values (1997-04-22)
Re: Multiple return values (1997-04-22)
Re: Multiple return values (Mike Ashley) (1997-04-22)
[18 later articles]
| List of all articles for this month |

From: steve mcadams <>
Newsgroups: comp.compilers,comp.lang.misc
Date: 20 Apr 1997 12:09:42 -0400
Organization: McAdams Research
References: 97-04-091 97-04-106
Keywords: design

> Clumsy syntax, mostly, and almost total ignorance of CPS by non-Lisp
> people.

I agree (though I don't know what CPS is), the syntax is difficult and
the implementation is also nontrivial. Here is the syntax that I used
in the Evolve language, which I am certain nobody here has ever heard
of since it never made it outside of IBM as far as I know:

(target1,target2,...targetn);(t1,,(t1,,... = func(whatever)

Each parenthesized list contains the variables to which the result
should be assigned. If the first parenthesized list is followed by a
semicolon, it indicates the "success" result. Subsequent lists
indicate the corresponding result values. For example, this:

(a,b);(c,d),e = xxx()

calls xxx(), places the success code in "a" and "b", places the first
result in "c" and "d", places the second result in "e", and discards
any subsequent results. To call yyy() and place the first and second
results in "f" and "g" you would code: f,g = yyy() If you wanted to
call zzz() and place the second result in "h" you would code: ,h =

This syntax resulted from many many hours of trying to figure out
something that would be flexible enough to do the job yet simple
enough to be remembered. I think it is probably fairly decent for,
what that's worth.

Behind the scenes, it used an identical parameter list for arguments
and results; this consisted of the number of arguments followed by the
datatype of each and a pointer to its data.

The language was intended for distributed apps and had built-in RPC
with data conversion (EBCDIC/ASCII etc), and its own threading
architecture to ensure identical operation on disparate platforms.
The funny thing is that by the time I completed the prototype they had
decided against going after the application-set it was directed at
(helpdesk automation) so it was stillborn. Whatever.

The thing that is clumsiest (in my opinion) about multiple results is
that the "if (x())" and the "y = x()" scenarios somehow don't seem to
coincide as well with multiple results. The "success" code is an
exception which always complexificates<sic> things. I think that if I
were doing it again it would be difficult to decide between the above
syntax and one which caused the return of only a single object which
was an argument/result list.

If anyone knows of other/better syntaxes for multiple results I would
be interested if they were posted. -steve
MFC GUI Toolkit -->

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.