Returning tuples from functions

Jari-Matti Mäkelä jmjmak at utu.fi.invalid
Tue May 1 16:04:16 PDT 2007


Jari-Matti Mäkelä wrote:

> BCS wrote:
> 
>> niovol wrote:
>>> When will it be possible? I have almost no experience in programming on
>>> D. But I can't imagine how to solve my problem without using tuples.
>> 
>> Here's a nasty hack I came up with a while ago
>> 
> <snipped the nasty hack>
> 
> The only problem is that the struct version is 27 opcodes or 150% longer
> that the inout/ref version at least on DMD/Linux. These hacks aren't very
> useful until the optimizer gets better or something else great happens.

It would also help the expression template code. I tried to come up with an
optimal version of adding matrices with a regular D syntax, but the
compiler couldn't remove some of the intermediate structs. I then tried the
example code from Don's BLADE, but even it didn't produce optimal code. Has
anyone found a solution to this? I don't think an improved optimizer is
enough, there should be a way to pass these 'AST references' at compile
time.



More information about the Digitalmars-d mailing list