C++ Logo

liaison

Advanced search

Re: [wg14/wg21 liaison] [isocpp-sg21] Telecon to review P2388R1 Minimum Contract Support: either Ignore or Check_and_abort

From: Jens Maurer <Jens.Maurer_at_[hidden]>
Date: Wed, 22 Sep 2021 17:55:35 +0200
On 22/09/2021 17.22, Andrzej Krzemienski wrote:
> Like
>
> ```
> int f(int a, int b)
> pre: a != 0,
> pre: b != 0,
> post r: r != 0
> {
> assert: a != b;
> }
> ```

Yes, something like that.

> And if we were to add additional "modifiers" in the future, such as `audit`:
>
> ```
> int f(int a, int b)
> pre: a != 0,
> audit pre: b != 0,
> audit post r: r != 0
> {
> assert: a != b;
> }
> ```

After "pre" should work as well (whatever your future preference might be).

> We will not make it for C++23 for sure. This has no implementation experience, and it is difficult to guess (at least for me) what parsing ambiguities this would cause.

Well, P2388R2 does not appear to discuss the choice of syntax
at all and seems to take [[ ... ]] for granted. Given that
we're adding a major feature, the choice of [[ ... ]] seems
undermotivated at this time.

Also, I'm not seeing any reference to implementation experience
in P2388R2 to start with.

> But definitely shorter than in the current proposal.

And avoids any confusion with (ostensibly) ignorable attributes.

Jens

Received on 2021-09-22 10:55:41