On Fri, Nov 27, 2026 at 8:25 PM Tony V E <tvaneerd@gmail.com> wrote:


On Fri, Nov 27, 2026 at 7:02 PM Barry Revzin via Std-Proposals <std-proposals@lists.isocpp.org> wrote:



'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 express the intent, very clearly, in a way that works great regardless of which argument(s) you actually want to specify. You don't even need to know what order we go in. 


Speaking of named params - since sort({.range = r, .by = f}) has become so common, does that suggest a syntax? ie just get rid of the { } ?  sort(.range = r, .by = f) ? Or sort(.range r, .by f) ?
I don't think .foo is ambiguous in that context?

Just curious.

--
Be seeing you,
Tony

I think sort(r, .by = f) is arguably the correct syntax for C++. It's unambiguous and has that parallel with initialization so it makes a lot of sense to me, and I think people will deduce the correct meaning from it when they see it?

 Syntax isn't really the hard/interesting question here. But there are a few of those:

  • how/whether to handle argument forwarding through variadic function templates
  • should names be opt-in or opt-out and, regardless, what is the syntax on the function parameter declaration side to do so (I used to think the right answer was opt-in but now I lean opt-out)
  • how/whether to have named-only or positional-only function parameters
  • I swear there was a 4th one I was thinking of when I started writing this email but now I'm drawing a blank. So I'll leave this as a placeholder bullet. 

Barry