Date: Sun, 29 Nov 2026 10:26:53 -0500
On Fri, Nov 27, 2026 at 7:14 PM Alejandro Colomar <
une+cxx_std-proposals_at_[hidden]> wrote:
> Hi Barry,
>
> > Date: 2026-11-27 19:01:43-0500
> > From: Barry Revzin <barry.revzin_at_[hidden]>
> >
> > On Fri, Nov 27, 2026, 8:28 AM Alejandro Colomar via Std-Proposals <
> > std-proposals_at_[hidden]> wrote:
> >
> > > Hi David,
> > >
> > > > Date: 2026-11-27 13:57:10+0100
> > > > From: David Brown <david.brown_at_[hidden]>
> > > >
> > > [...]
> > > > > Hmmm, yeah, so two people here have expressed preference for
> 'default'.
> > > > > When implementing this with macros in C, I also tried first to use
> the
> > > > > 'default' keyword, but I couldn't find a way to do it.
> > > >
> > > > I would certainly greatly prefer having "default" rather than
> omitting
> > > the
> > > > argument entirely
> > >
> > > Thanks!
> > >
> > > > - though I am still not convinced that default values in
> > > > arbitrary positions is a good idea. (I'd rather see progress made
> > > towards
> > > > name arguments in calls, as supported in many other languages - if
> that
> > > ever
> > > > makes it to C++, then this whole idea is moot.)
> > >
> > > I dislike named parameters. They make the call too long, and don't
> give
> > > much benefit.
> > >
> >
> >
> > They give tremendous readability and clarity benefit, and alleviate
> > problems with multi-argument functions.
> >
> > In C++, the best you can do right now is approximate named function
> > arguments by using designated initialization with a struct. This is more
> > limited than named arguments would be, and mildly tedious on the author
> > side, but the fact that people do it anyway - and many people are happy
> to
> > learn this idiom - is a pretty clear indicator of the value of using
> names.
>
> FWIW, the don't add any readability to me. I'm not saying you should
> not like them. I'm only saying that _I_ don't like them. And I will
> not accept that default arguments should not be pursued because others
> like named arguments.
>
> That said, if you like named arguments, you're welcome to ask for named
> arguments to be implemented and/or standardized. I'm not going to say
> you shouldn't, nor will tell you what you should like.
>
> > > 'default' better expresses the intent: this parameter has a default
> > > value.
> > >
> >
> > This might be literally true but practically speaking is definitely
> false.
> >
> > Yes, in some sense, it expresses the intent that sort(r, default, f) is
> > using the default value of the 2nd parameter. However, this does
> absolutely
> > nothing to express the actual intent of the code, because you have to
> > actually know the order of all the parameters, which is usually not
> > relevant to either the caller or the reader. This also scales terribly
> when
> > the one argument you want to specify is the 6th one. Or was it the 7th?
> Or
> > 5th? It also doesn't hold up very well on refactoring.
> >
> > On the other hand, sort(r, by: f) (or whatever syntax) actually does
>
> Now you need to answer more questions: which parameter is r? If you
> name one argument, you should name them all, or you have a bunch of
> questions that are hard to answer. We currently have issues in
> designated initializers, precisely when one only designates some
> member.
>
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). There are a lot of programming languages already that allow for
this sort of thing: Python, C#, Kotlin, Ruby, PHP, Scala, Nim, ... Some
actually allow arbitrary interleaving between named and positional (OCaml,
Racket) but I don't think that's necessary.
>
> Also, this makes the names that a library uses become part of the API,
> which is something that libraries may not want to expose.
>
>
> Have a lovely night!
> Alex
Alternatively, it allows names to become part of the API, which is
something that libraries would want to expose but currently cannot (or
expose via strong typing or the designated initializer pattern).
Barry
une+cxx_std-proposals_at_[hidden]> wrote:
> Hi Barry,
>
> > Date: 2026-11-27 19:01:43-0500
> > From: Barry Revzin <barry.revzin_at_[hidden]>
> >
> > On Fri, Nov 27, 2026, 8:28 AM Alejandro Colomar via Std-Proposals <
> > std-proposals_at_[hidden]> wrote:
> >
> > > Hi David,
> > >
> > > > Date: 2026-11-27 13:57:10+0100
> > > > From: David Brown <david.brown_at_[hidden]>
> > > >
> > > [...]
> > > > > Hmmm, yeah, so two people here have expressed preference for
> 'default'.
> > > > > When implementing this with macros in C, I also tried first to use
> the
> > > > > 'default' keyword, but I couldn't find a way to do it.
> > > >
> > > > I would certainly greatly prefer having "default" rather than
> omitting
> > > the
> > > > argument entirely
> > >
> > > Thanks!
> > >
> > > > - though I am still not convinced that default values in
> > > > arbitrary positions is a good idea. (I'd rather see progress made
> > > towards
> > > > name arguments in calls, as supported in many other languages - if
> that
> > > ever
> > > > makes it to C++, then this whole idea is moot.)
> > >
> > > I dislike named parameters. They make the call too long, and don't
> give
> > > much benefit.
> > >
> >
> >
> > They give tremendous readability and clarity benefit, and alleviate
> > problems with multi-argument functions.
> >
> > In C++, the best you can do right now is approximate named function
> > arguments by using designated initialization with a struct. This is more
> > limited than named arguments would be, and mildly tedious on the author
> > side, but the fact that people do it anyway - and many people are happy
> to
> > learn this idiom - is a pretty clear indicator of the value of using
> names.
>
> FWIW, the don't add any readability to me. I'm not saying you should
> not like them. I'm only saying that _I_ don't like them. And I will
> not accept that default arguments should not be pursued because others
> like named arguments.
>
> That said, if you like named arguments, you're welcome to ask for named
> arguments to be implemented and/or standardized. I'm not going to say
> you shouldn't, nor will tell you what you should like.
>
> > > 'default' better expresses the intent: this parameter has a default
> > > value.
> > >
> >
> > This might be literally true but practically speaking is definitely
> false.
> >
> > Yes, in some sense, it expresses the intent that sort(r, default, f) is
> > using the default value of the 2nd parameter. However, this does
> absolutely
> > nothing to express the actual intent of the code, because you have to
> > actually know the order of all the parameters, which is usually not
> > relevant to either the caller or the reader. This also scales terribly
> when
> > the one argument you want to specify is the 6th one. Or was it the 7th?
> Or
> > 5th? It also doesn't hold up very well on refactoring.
> >
> > On the other hand, sort(r, by: f) (or whatever syntax) actually does
>
> Now you need to answer more questions: which parameter is r? If you
> name one argument, you should name them all, or you have a bunch of
> questions that are hard to answer. We currently have issues in
> designated initializers, precisely when one only designates some
> member.
>
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). There are a lot of programming languages already that allow for
this sort of thing: Python, C#, Kotlin, Ruby, PHP, Scala, Nim, ... Some
actually allow arbitrary interleaving between named and positional (OCaml,
Racket) but I don't think that's necessary.
>
> Also, this makes the names that a library uses become part of the API,
> which is something that libraries may not want to expose.
>
>
> Have a lovely night!
> Alex
Alternatively, it allows names to become part of the API, which is
something that libraries would want to expose but currently cannot (or
expose via strong typing or the designated initializer pattern).
Barry
Received on 2026-11-29 15:27:09
