Multiple return value as requirements for safety and performance

Nordlöw via Digitalmars-d digitalmars-d at puremagic.com
Tue Dec 20 07:40:57 PST 2016


On Tuesday, 20 December 2016 at 13:47:50 UTC, Ilya Yaroshenko 
wrote:
> One good thing for safety and CTFE is allow multiple return 
> value. In combination with `auto ref` it is _very_ powerful:
>
> auto ref front()
> {
>   // Returns 2 values, each value is returned by reference if 
> possible
>   return (a.front, b.front);
> }

I'd love to have this syntax aswell.

> I am not good in DIPs and hope someone is interested in this 
> feature too

DIP-32 has been dormant since 2013. I've been waiting for builtin 
tuples ever since I started using D. I believe the community 
agrees upon that we want the Python-style syntax to be used. But 
in order for this to be integrated we must wait out the 
deprecation of the C-inherited comma expression to become an 
error. Correct me if I'm wrong.

See:

- https://wiki.dlang.org/DIP32
- http://forum.dlang.org/post/kj44fs$2iil$1@digitalmars.com

Didn't Kenji Hara implement one of his proposals in DMD?...I 
might remember wrong.


More information about the Digitalmars-d mailing list