In the D 1.007 change log, it states:
out and inout parameters are now allowed for compile time function execution.
Does anybody know exactly what this means? I've tried a few different things, but no luck at getting anything to compile.

Xinok wrote:
> In the D 1.007 change log, it states:
> out and inout parameters are now allowed for compile time function execution.
> > Does anybody know exactly what this means? I've tried a few different things, but no luck at getting anything to compile.
The out and inout are only for functions called by compile time executed functions.

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

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
agreed.
> 2) it makes no sense to have a compile time function return its value via an out or inout rather than the return value
This just seems to be a pretty arbitrary restriction. I'm not saying I'd use it for anything other than testing if it works, but I don't see any technical reason to forbid it either...

> The out and inout are only for functions called by compile time executed functions.
I figured that much. Frits cleared it up though, it was because I had no return type that the compiler was restricting me from compiling it.
I think this is one restriction which should be lifted, or at least modified to allow functions with out / inout parameters. I believe restrictions should only be put in place in a language if it prevents something dangerous, such as returning the address of a local variable, or using an uninitalized variable. This is one restriction which doesn't prevent anything dangerous, and is just something which programmers will be forced to work around.

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