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: Gabriel Dos Reis <gdr_at_[hidden]>
Date: Mon, 20 Sep 2021 20:34:16 +0000
The contract syntax is similar but not exactly attribute syntax. We don't want to encourage implementations to ignore them - even if ignoring them for a correct program is not observable.

-- Gaby

-----Original Message-----
From: SG21 <sg21-bounces_at_[hidden]> On Behalf Of Jens Maurer via SG21
Sent: Monday, September 20, 2021 1:24 PM
To: Uecker, Martin <Martin.Uecker_at_[hidden]>; liaison_at_[hidden]; sg21_at_[hidden]
Cc: Jens Maurer <Jens.Maurer_at_[hidden]>
Subject: Re: [isocpp-sg21] [wg14/wg21 liaison] Telecon to review P2388R1 Minimum Contract Support: either Ignore or Check_and_abort

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++

https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.open-std.org%2Fjtc1%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2021%2Fp2388r2.html&amp;data=04%7C01%7Cgdr%40microsoft.com%7C8787fc8d8d9a4c0c0f8e08d97c74898d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637677662250175621%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=7a2Kj2G0DGr3Y0qXqOkOhSUuSlkbEQ%2Bv4OwGoepymR8%3D&amp;reserved=0

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

Jens
_______________________________________________
SG21 mailing list
SG21_at_[hidden]
Subscription: https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.isocpp.org%2Fmailman%2Flistinfo.cgi%2Fsg21&amp;data=04%7C01%7Cgdr%40microsoft.com%7C8787fc8d8d9a4c0c0f8e08d97c74898d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637677662250185612%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=9PF%2BOaVym0VHOV0iLvZUZPY7A9bnLXKS%2FTAIphXHIWw%3D&amp;reserved=0
Link to this post: https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.isocpp.org%2Fsg21%2F2021%2F09%2F1191.php&amp;data=04%7C01%7Cgdr%40microsoft.com%7C8787fc8d8d9a4c0c0f8e08d97c74898d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637677662250185612%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=ibGwtgrz2w28Z93NPwuatygGP2Y79iTm5bl3TcICEQ8%3D&amp;reserved=0

Received on 2021-09-20 15:34:26