Date: Thu, 3 Dec 2026 00:50:43 +0100
On 11/29/26 16:37, Alejandro Colomar via Std-Proposals wrote:
> Hi Barry,
>
>> Date: 2026-11-29 10:26:53-0500
>> From: Barry Revzin <barry.revzin_at_[hidden]>
>>
> [...]
>>>> On the other hand, sort(r, by: f) (or whatever syntax) actually does
>> I don't think these are hard questions to answer. r is the first parameter,
>> and you can provide positional arguments followed by named arguments, where
>> the named arguments allow reordering (but cannot repeat positional
>> arguments).
>
> What does it mean "where the named arguments allow reordering"?
>
> We have some experience with designated initializers, and it shows it's
> not a good thing. Compilers disagree on what the following program
> means:
>
> alx_at_devuan:~/tmp$ cat desig.c
> #include <stdio.h>
>
> struct {
> char str[16];
> } hello = {
> "hello world",
> .str[6] = 'W',
> "ORLD"
> };
This might be syntactically valid C, but it's not valid C++.
For designated initialization of structs, we don't allow reordering
of initializers because of C++ destruction order. Do we feel the
same for function arguments? As long as function parameter objects
are constructed and destroyed in the caller, it's not a problem,
but C++ used to allow callee-destroyed function parameter objects.
> Considering that per your own words it's already hard to keep track of
> the absolute positions of arguments, keeping track of their relative
> positions is much worse.
The designated parameters have names, so are easy to keep track of.
Jens
> Hi Barry,
>
>> Date: 2026-11-29 10:26:53-0500
>> From: Barry Revzin <barry.revzin_at_[hidden]>
>>
> [...]
>>>> On the other hand, sort(r, by: f) (or whatever syntax) actually does
>> I don't think these are hard questions to answer. r is the first parameter,
>> and you can provide positional arguments followed by named arguments, where
>> the named arguments allow reordering (but cannot repeat positional
>> arguments).
>
> What does it mean "where the named arguments allow reordering"?
>
> We have some experience with designated initializers, and it shows it's
> not a good thing. Compilers disagree on what the following program
> means:
>
> alx_at_devuan:~/tmp$ cat desig.c
> #include <stdio.h>
>
> struct {
> char str[16];
> } hello = {
> "hello world",
> .str[6] = 'W',
> "ORLD"
> };
This might be syntactically valid C, but it's not valid C++.
For designated initialization of structs, we don't allow reordering
of initializers because of C++ destruction order. Do we feel the
same for function arguments? As long as function parameter objects
are constructed and destroyed in the caller, it's not a problem,
but C++ used to allow callee-destroyed function parameter objects.
> Considering that per your own words it's already hard to keep track of
> the absolute positions of arguments, keeping track of their relative
> positions is much worse.
The designated parameters have names, so are easy to keep track of.
Jens
Received on 2026-12-02 23:50:50
