C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Derived class's function invokes base class's function

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Fri, 15 Apr 2022 16:03:54 -0400
On Fri, Apr 15, 2022 at 3:32 AM Frederick Virchanza Gotham via
Std-Proposals <std-proposals_at_[hidden]> wrote:
>
> On 4/14/22, Jason McKesson via Std-Proposals wrote:
> >
> > Your proposal is way more complicated, and I think it will be far less
> > useful to most C++ programmers.
>
>
> I'm going to take Marcin's alternative solution and copy-paste it into
> my document, then I will compare the two. The main difference between
> Marcin's solution and my own new language feature is that my new
> language feature is incredibly simple to use -- easier to use and less
> error-prone as the compiler does all the technical work, less human
> error.
>
> As for the complexity it will add to designing and coding compilers,

Just to be clear, my point was not specifically about complexity added
to compilers. I was referring to complexity added to the *language*.

First, you're overloading keywords with new functionality that is at
best marginally based on the literal text of the keyword. Just try to
explain to someone how "requires continue" relates to the usual
meaning of "requires" in that position of a function declaration.

Second, it creates very strange control-flow dynamics, where the
presence of a keyword outside of the body of the function causes other
functions to be called when you call that function. That's similar to
calling constructors of subobjects, but it's still really bizarre (and
it doesn't use member initialization list syntax).

Third, there are multiple interactions between keywords that make
understanding what's going on difficult. For example, the behavior of
`continue` prefixed by `requires` is completely different from the
behavior of `continue` alone.

The feature is complicated, not because it's hard to implement, but
because of what it is doing. It's doing something complicated, novel,
and uses keywords in a novel way to do it.

Received on 2022-04-15 20:04:58