javaggravation
Python and Ruby both recognize this as valid syntax:

a, b, c = 1, 2, 3

a, b, c = function_call()

The MOO programming language also allows something like this.
--Nick B Fri Sep 17 07:25:23 2004
Yeah, but I was thinking of non-hippy languages...
--Kirk Fri Sep 17 09:27:50 2004
Well, C++ allows pass by reference. It's not as elegant as (a,b,c) = foo(x,y,z), and since there isn't anything visible at the calling level it can get a little confusing. But there are just some times where it's 10x better than mucking around with pointers.

Personally, I prefer to have the return parameter a simple return code, with the actual returned values either passed in as pointers or references.

--ericball Fri Sep 17 10:54:20 2004
Pass-by-reference is how Java is doing it for all non-primitive types, right? If I recall correctly, C++'s reference was mostly a semantic nice-ity, letting you get away from ugly pointer de-referencing in the code...

I guess my problem with your prefered method is that it's just not clear. I tend to assume input parameters are input parameters, and not doing double duty. (of course, that can be a dangerous assumption...)
--Kirk Fri Sep 17 11:57:09 2004
Hurricane Ivan...sigh. What a beautiful hurricane!
--Candi Fri Sep 17 14:40:11 2004
Err....probably more beautiful from an orbiting space station than, say, out the window of your Florida trailer home...
--Kirk Fri Sep 17 15:15:14 2004
the perl you showed is just syntactic sugar for getting things out of the list/array returned by the function. Perl, like Java, can only return one thing, it just makes it easier to look at the components of the list that comes out.
--masukomi Sat Sep 18 00:12:35 2004
I see what you mean in theory, but given how Perl is loosely typed and Java is strongly typed, in practice it's a world of difference. I mean, returning a collection of Object and then casting specific members of that collection is Ugly with a capital-UGH
--Kirk Sat Sep 18 00:26:28 2004
I remember returning multiple values in Assembly (various architectures). Something like: if CF=0 (Carry Flag) then BX contains a pointer to the result, else if CF=1, then AX has an error code. In fact, any number of items (depending upon the architecture) could be easily returned and I sorely missed that in nearly every other language I've used.

But there are other aspects to consider when returning multiple values. Take, for instance, the following (in C):

if (strcmp(a,b) == 0) { }

How would you work that with a function that returns multiple parameters? Leftmost is checked? Rightmost?

And yes, that is a cool picture of Ivan. I have a collectio of Frances when we here in Florida were impatiently awaiting her arrival and while nice, you don't get to see the satellite in question.


--Sean Conner Sat Sep 18 03:39:56 2004
Hm, good point Sean. I would say that for testing multiple return values in place, something like

if(somefunction() == (5,"hey","ho"))

might work...with all primitives tested on == and all objects on .equals , with a "short circuit" operator in place, first it tests the leftmost, and if they're equal, only then does it go on to test the next one, until it finds unequal values or runs out of equal ones...
--Kirk Sat Sep 18 08:52:32 2004
Nobody else is saying it, so I will.

NEEEEEERRRRRRRDS!
--LAN3, a nerd. Sat Sep 18 12:37:42 2004
Alright, master of Unix print queues...
--Kirk Sat Sep 18 19:05:57 2004
This is way more helpful than anything else I've lokoed at.
--Star Mon Aug 1 04:43:47 2011
IFotNf Read, of course, far from my topic. But still, we can work together. How do you feel about trust management?!...
--buy oem software Sun Feb 12 00:01:25 2012
GDWC2a Thank you ever so for you article.Really looking forward to read more. Great.
--Microsoft OEM Software Thu Mar 8 03:32:57 2012
oY30z5 Awesome article post.Much thanks again. Really Cool.
--best internet marketing agency Wed Apr 18 11:25:56 2012
Nash If you remember Grams plaese email me or see me on facebook. Imiss you so very much and have nearly given up trying to find you.. I do miss you so much and have absoutly so much to catch you up with !  Love you, Grams
--Roberto Thu Sep 19 05:23:36 2013

Comments Disabled... (Thanks Dirty Rotten Spammers)
Feel free to write kirkjerk at gmail dot com!