News for hackers. Stuff that matters.
Re:Fun with C++26 reflection: Keyword Arguments by xmcqdpt2 on Wednesday February 12, 2025 @06:51AM (#43024406)
Scala does it by pulling out the keyword arguments to variables so that your example would become

{ val x$1 = B() val x$2 = A() A(.one = x$2, .two = x$1) }

This maintains left-to-right evaluation order while allowing you to pass arguments in any order.

There is probably some dark and forbidden reason why C++ can't do that.

ETA: That's basically what the post does.

There are no comments on this comment yet.