Order of evaluation for named arguments
Salih Dincer
salihdb at hotmail.com
Sun Mar 30 09:40:10 UTC 2025
On Sunday, 30 March 2025 at 09:14:49 UTC, Daniel N wrote:
>
> I think you are overlooking one important detail,
> StructInitializer, it must match named arguments and
> fortunately it does.
It's a great perspective, but I don't think it's directly related
to our topic. I've tried to increase the value below, but I
haven't been successful in establishing relevance. 😇
```d
auto inc(T)(ref T value)
{
scope(exit)
value.writeln;
return ++value;
}
struct S { int a, b; }
import std.stdio;
void main()
{
auto x = 41;
x.writeln;
S s = {
b : inc(x),
a : inc(x)
};
s.writeln;
}
```
SDB at 79
More information about the Digitalmars-d
mailing list