Compile Time Execution of Inout Parameters

Bill Baxter dnewsgroup at billbaxter.com
Sun Mar 4 13:41:56 PST 2007


Walter Bright wrote:
> Frits van Bommel wrote:
>> It seems functions returning void can't be executed at compile time, 
>> even if they have out/inout parameters...
> 
> This is by design:
> 
> 1) functions with no output make no sense evaluating at compile time
> 
> 2) it makes no sense to have a compile time function return its value 
> via an out or inout rather than the return value

That seems kind of arbitrary.  The first thought that came to mind was 
what if you need to return two values?  For instance a min-max function 
that returns both the minimum and maximum value.  In that case it would 
be weird to arbitrarily pick one as the "real" return value and make the 
other an out parameter.

--bb



More information about the Digitalmars-d mailing list