Wishlist proposal, documenting fn arg as in or out or mod
Dom DiSc
dominikus at scherkl.de
Tue Jun 20 15:56:55 UTC 2023
On Tuesday, 20 June 2023 at 15:01:17 UTC, Cecil Ward wrote:
> void myfn( in T1 InputArg, in const ref InputArray1, rw Modify,
> out result )
why not
```d
void myfn(in T1 InputArg, const ref T2 InputArray1, ref T3
Modify, out T4 result);
```
a "const ref" is of course read only, and a simple "ref" is
expected to be modified by the function (else you would have made
it const, wouldn't you?).
so you have read only (const ref), write only (out) and
read/write (ref)
plus additionally "in" (which may be ref or not, based on what
the compiler sees best fit).
I can't see the necessity for a new keyword.
By the way, what should "const in" be for?!? "in" is already not
to be modified by the function. It is only there to allow both
l-values and r-values to be used as input.
More information about the Digitalmars-d
mailing list