www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Multiple return values

--20cf302ef924e1c0d104b5a7615b
Content-Type: text/plain; charset=UTF-8

Why doesn't D support multiple return values like many other modern
languages?

Clearly the same syntax as Go wouldn't work, but I'm sure a neat and tidy
syntax could be invented?
I constantly want to be able to return x,y from a function, or
retVal,errorCode and I want the language to make some rough ABI guarantees,
like multiple return values will be returned in consecutive registers,
rather than a single return value register like C/C++, avoiding the need to
pass output addresses through ref function parameters (slow!).

--20cf302ef924e1c0d104b5a7615b
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Why doesn't D support multiple return values like many other modern lan=
guages?<div><br></div><div>Clearly the same syntax as Go wouldn&#39;t work,=
 but I&#39;m sure a neat and tidy syntax could be invented?</div><div>I con=
stantly want to be able to return x,y from a function, or retVal,errorCode =
and I want the language to make some rough ABI guarantees, like multiple re=
turn values will be returned in consecutive registers, rather than a single=
 return value register like C/C++, avoiding the need to pass output address=
es through ref function parameters (slow!).</div>

--20cf302ef924e1c0d104b5a7615b--
Jan 03 2012