Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

hai prog: multiple return values

Name: Anonymous 2009-10-02 19:31

Hello

I know one can use pass-by-reference for getting multiple values back from a function, but is there a language that allows you to actually define multiple outputs seperate from the parameter list for super neatness.

I was thinking it would be super-cool to have an auto-defined struct based on the function return values. so in some pseudo-language it would be like...


def splitstring  string<s char<sep string>a string>b

s = "hello world"

splitstring s ' '

printf(splitstring.a)
printf(splitstring.b)


would that be totally kawaii aewsome?

obviously each thread would have its only instances of these auto-structs.

Name: Anonymous 2009-10-06 2:05

>>53,55

#include <stdio>

int main (int argc, char **argv)
{
   int foo = 1;
   char bar = 'a';

   if (foo == 1)
   {
      printf("bar: %c", bar);
   }

   return 0;
}
[code]

or

[code]
foo = 1
bar = '1'

if foo == 1:
   print "bar: " + bar

return 0


I can assure you, not only did the second one take longer to write per line (because you have to consciously look at indentation and remember where you are), but it took longer to read (per line).  This is a simple program, too.  Imagine a full blown program, like an operating system.  This is why they don't write operating systems in languages such as Python.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List