Related articles |
---|
Multiple return values Arthur.Chance@Smallworld.co.uk (1997-04-16) |
Re: Multiple return values WStreett@shell.monmouth.com.spamguard (1997-04-18) |
Re: Multiple return values smryan@mail.com (1997-04-18) |
Re: Multiple return values icedancer@ibm.net (1997-04-18) |
Re: Multiple return values hbaker@netcom.com (1997-04-18) |
Re: Multiple return values fjh@mundook.cs.mu.OZ.AU (1997-04-18) |
Re: Multiple return values (Mars Saxman) marssaxman%sprynet.com.antispam@nac (marssaxman) (1997-04-18) |
Re: Multiple return values preston@tera.com (1997-04-18) |
Re: Multiple return values jbuck@Synopsys.COM (1997-04-18) |
Re: Multiple return values smryan@mail.com (1997-04-20) |
Re: Multiple return values danwang@dynamic.CS.Princeton.EDU (1997-04-20) |
Re: Multiple return values smcadams@sprynet.com (steve mcadams) (1997-04-20) |
Re: Multiple return values tiggr@es.ele.tue.nl (1997-04-20) |
Re: Multiple return values hrubin@stat.purdue.edu (1997-04-20) |
[22 later articles] |
From: | preston@tera.com (Preston Briggs) |
Newsgroups: | comp.compilers,comp.lang.misc |
Date: | 18 Apr 1997 01:08:25 -0400 |
Organization: | /etc/organization |
References: | 97-04-091 |
Keywords: | design |
Arthur.Chance@Smallworld.co.uk (Arthur Chance) writes:
>Most programming languages allow procedures with multiple arguments
>(in some cases allowing them to be used in curried form as well), but
>very few languages allow multiple return values [,,,]
>Why is this?
A lot of the problem is due to syntax.
Everyobe likes to write things like
a = b*sin(c)
where sin is a function invocation.
If we define a routine like sincos(x), how are we going to use it
in an expression?
One attractive approach is used by Beta (a European project).
They seem to have rethought a lot of ideas from ground zero.
First off, assignment works left to right, like this
a + b => c
(I'm approximating the actual symbols, since I can't remember them).
Or
a + b => c => d
Or
a + b, c + d => e, f
Or
sincos(x) => y, z
Or
x => sincos => y, z
Or
1, 2 => sumdifrev => AplusB, AminusB, BminusA
where sumdifrev might be defined like
sumdifrev(int x, int y)
return x+y, x-y, y-x
Or
x => sincos => sumdifrev => x, y, z
There used to be a fair amount about the language on the net, along
with some implementations. Haven't looked in a while.
Preston Briggs
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.