On Tuesday, November 24, 2015 at 9:21:30 AM UTC-8, Patrice Roy wrote:
Maybe I'm misunderstanding your point. Tell me where I'm wrong:
- In a simple aggregate with public data members, designated initializers would let us initialize data members through their names, which is not a problem as the names are part on the interface. This is not a problem for me
- In a class with private data members and its ctors, or with a function signature in general, designated initializers would let us use the arguments by name, circumventing the link between the order of arguments on the caller's side and on the callee's side. This is not necessarily a bad thing, except that it binds the names in the caller code to the names in the callee's signature. This name binding is a serious bother in my view; I do not see this «addition» to the callee's interface as a positive feature (to say the least)
If I'm misunderstanding the proposal on this last point, then I might have missed how the link between the names used in client code and in the called functions is made (it's quite possible). Unless I'm mistaken, there will need to be a by-name link somewhere, which seems to me like a maintenance problem anywhere but where those names were already public and documented as such in the first place.
He isn't proposing anything that needs that. He doesn't want to support constructors and wants only designated initialization of aggregates (i.e. simple structs, maybe with base class support tossed in).
I, not he, argued that this non-holistic design is the wrong approach for C++ and that constructors must be considered for this feature to be worth taking to and through the committee.
Yes, any serious proposal that does involve function parameter names would most absolutely have to provide a way to opt-in to having the names become part of the API, with the default for them to not. This opt-in would either be at the function declaration via some new [use of a] [contextual] keyword or sigil or even be per-parameter.
My original treatise of the subject some ~6-12 months ago started out with a position identical (or very similar) to Jason's: get aggregate designated initializers through the committee first by themselves, then see about extending that to constructors as a second proposal, then the coup de grace of named parameters. My opinion on the matter has evolved since then.