C++ Logo

std-discussion

Advanced search

Re: The unnecessary confusion of the C++23 proposal P0847R6

From: Jens Maurer <Jens.Maurer_at_[hidden]>
Date: Sat, 31 Jul 2021 08:04:30 +0200
On 30/07/2021 23.19, Hani Deek via Std-Discussion wrote:
> The only thing in the paper that is impossible to do with the regular non-static member functions is to pass the object parameter by value. But what is the importance of this feature?

It allows register passing of values of simple classes, instead of by-pointer.

> I suggest that the authors take a look at the feature called "extension methods" of the C# language. That feature is very close to their proposal, but it is formulated in a much better and cleaner way. The extension methods of C# are ordinary static functions that can be defined anywhere, not necessarily in a class scope.

This is a feature, not a bug of the current proposal: The interface of a
class should be completely specified by the class definition, and not
be scattered.

In any case, if you have a coherent alternative proposal, I think WG21 will
be all ears. Please make sure to address (at least in the narrative in your
paper) all use cases that P0847R6 in fact addresses, including (for example)
recursive lambdas.

Jens

Received on 2021-07-31 01:04:35