|
Boost : |
From: Vinnie Falco (vinnie.falco_at_[hidden])
Date: 2024-12-19 20:47:10
On Thu, Dec 19, 2024 at 12:13â¯PM Ivan Matek <libbooze_at_[hidden]> wrote:
> I am not sure what you mean by current rules of the language. There is no
> such thing in this case since language allows both.
>
The language allows for free functions so we have to give them equal weight.
> If you are talking about what experts prefer in terms of design...
> ...
> Herb and Bjarne
>
...
> Core guidelines
> ...
> Barry Revzin
> ...
>
The needs and incentives of people who do standardization work are
different from people who publish and maintain third party libraries.
Changes proposed to the standard library have the luxury of not worrying
about third party libraries. That is, when a wg21 apparatchik adds a member
function to all associative containers, the amount of work is bounded as
the number of containers in the standard library is a small constant. Of
course, that approach is as short-sighted as is the assumption that highly
active committee participants are experts.
I think the impact of a design choice should be measured not only by what
it does to the standard but how it affects the entire C++ ecosystem. Thus I
restate to my original point. Given that free functions are as equally
ergonomic as member functions, the better of:
1. Modify the source code for every current and future associative
container to include a new member function, or
2. Write a single free function which works with every current and
future associative container
should be obvious (it is 2). If you would like to list the specific reasons
why you believe the member function better, I could respond to each point.
Thanks
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk