Date: Wed, 22 Sep 2021 21:27:11 +0200
śr., 22 wrz 2021 o 17:55 Jens Maurer <Jens.Maurer_at_[hidden]> napisał(a):
> 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.
>
Here is one implementation by Andrew Sutton and Wyatt Childer:
https://godbolt.org/z/6Mv7dYcYd
It implements a superset of what P2388R2 proposes. It is described in
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2049r0.pdf.
Regards,
&rzej;
> > But definitely shorter than in the current proposal.
>
> And avoids any confusion with (ostensibly) ignorable attributes.
>
> Jens
>
> 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.
>
Here is one implementation by Andrew Sutton and Wyatt Childer:
https://godbolt.org/z/6Mv7dYcYd
It implements a superset of what P2388R2 proposes. It is described in
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2049r0.pdf.
Regards,
&rzej;
> > But definitely shorter than in the current proposal.
>
> And avoids any confusion with (ostensibly) ignorable attributes.
>
> Jens
>
Received on 2021-09-22 14:27:24