Feature Request for 2.0: A way to implement MRV

Downs default_357-line at yahoo.de
Fri Aug 31 17:50:44 PDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jari-Matti Mäkelä wrote:
> Downs wrote:
>> First, the redefinition of the comma operator to combine variables into
>> a new type of tuple: a variable tuple, that being a set of variables
>> combined under a common name, that a tuple can be assigned to.
>>
>> Second, and probably more important, the ability to implicit cast a
>> struct to a tuple.
>>
>> This would allow us to extend the current solution of returning a
>> TupleStruct to implicitly assigning that tuple struct to a group of
>> variables without needing to store their pointers separately, as is
>> currently done.
> 
> votes++;
> 
> http://d.puremagic.com/issues/show_bug.cgi?id=1293
> 
> What makes me a bit worried is that the 'future of D' slides didn't say much
> about tuples. It's a natural extension to the current type system and
> improves the readability of code (and hopefully also deprecates those
> ad-hoc implementations with templates that actually are an order of
> magnitude slower than e.g. out parameters).

Thanks for your reply. I actually intended to ask for the ability to
return tuples, but seeing how Walter feels about hard-to-implement
features (and it has to be hard to implement, considering how useful it
would be), I thought it better to ask for something easier to implement :)

Naturally, enhanced tuple functionality at the cost of the
not-much-needed comma operator would be infinitely preferable to merely
improving the look-and-feel of what still is an ugly, struct-based
pointer hack (MRV). Also, it has occured to me that the current function
of the comma operator could be largely emulated by allowing the implicit
conversion of a tuple to its last element, though if that is a good idea
I cannot see. Ah well.
Glad to hear your opinion,
 --downs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG2LdkpEPJRr05fBERAgL/AKCc3tCe526Du5jm8TYa4OyuR38VPwCfaoWY
RPlVD2s1t20VLo4K7lIi50Y=
=uWK8
-----END PGP SIGNATURE-----



More information about the Digitalmars-d mailing list