Optional extra return value? Multiple return values with auto?

Ali Çehreli acehreli at yahoo.com
Tue Aug 14 18:42:10 PDT 2012


On 08/14/2012 06:22 PM, Era Scarecrow wrote:
 > On Wednesday, 15 August 2012 at 00:37:32 UTC, ReneSac wrote:
 >> And my last question of my first post: I can't use "auto" for the
 >> "out" values right? An enhancement proposal like this would be
 >> compatible with D?
 >
 > I would say.... No. Maybe if it was a union, but I don't think so;.It
 > still needs to know it's type when it's working with, aka statically
 > typed (known at compile-time).
 >
 > The auto as an out variable may work in an interpreted or more dynamic
 > language.

Agreed. The function code must be compiled to use certain amount of data 
from the program stack for that particular parameter. That size of that 
parameter must be known at compile time.

The compiler could in theory examine the entire program to determine a 
type for the parameter but the separate compilation model would preclude it.

Ali



More information about the Digitalmars-d-learn mailing list