C++ Logo

sg7

Advanced search

Re: [isocpp-sg7] P0707

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Tue, 22 Oct 2024 21:48:53 +0300
On Tue, 22 Oct 2024 at 19:35, Daveed Vandevoorde via SG7
<sg7_at_[hidden]> wrote:
>
>
>
> On Oct 22, 2024, at 12:29 PM, Peter Dimov via SG7 <sg7_at_[hidden]> wrote:
>
> Herb Sutter wrote:
>
> Thanks Bengt,
>
> Yes, the syntax in current P0707 is mainly just to be following what SG7 last
> directed. Example:
>
> // Current P0707, per SG7’s last direction
>
> class(interface) IFoo { … };
>
> But now that we have @, I agree with Bengt that
>
> @interface class IFoo { … };
>
> is both [...]
>
>
> FWIW, I like the `class(things...)` syntax. It doesn't require innovation,
> is straightforward, and free of obstacles.
>
>
> Very much agreed.

"class(things)" is certainly nice because it gives us a syntax that is
as close as we can get to UML Stereotypes,
which are <<things>>, which is a syntax that we just.. ..can't even
begin to use. And we can't put these things
after the class keyword, because then it is very confusing what's a
name and what's a context-sensitive keyword
and what's a metaprogram to run on the class. class(things) avoids
those problems, and hits the important goals
of being on the class-head, and being a clear syntax for triggering a
metaprogram.

But it has a severe limitation. UML Stereotypes can apply to things
finer-grained, like
<<getter>> on a function. It seems completely plausible that we could
eventually entertain meta-transformations
of individual functions, not just classes.

Received on 2024-10-22 18:49:07