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: Mon, 20 Sep 2021 22:23:30 +0200
On 20/09/2021 21.51, Uecker, Martin wrote:
> But if we adopt this syntax for contracts, shouldn't
> we add generic syntax such as:
>
> [[attribute-token : conditional-expression]]
>
> instead of having only "pre", "post", and "assert"?
> Then future extensions would benefit from syntax
> (and type?) checking even with older compilers.

I'm not good enough looking into the future to anticipate
whether all future extensions in that area will necessarily
have a condition-expression after the introducer.

I do notice that the current proposal on the table for C++

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2388r2.html

uses "[[post r: r >= 0]]" to designate the return value as "r".
That would be incompatible with your proposed generic grammar.

Jens

Received on 2021-09-20 15:23:36