220 39422 <pjddad$kii$1@blaine.gmane.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Bo Persson <bop@gmb.dk>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Contract attributes and trailing return types
Date: Thu, 26 Jul 2018 23:11:42 +0200
Lines: 52
Approved: news@gmane.org
Message-ID: <pjddad$kii$1@blaine.gmane.org>
References: <b39be2a8-c0c4-4887-a4ad-d11a50107aa9@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"; format=flowed
X-Trace: blaine.gmane.org 1532639388 22015 195.159.176.226 (26 Jul 2018 21:09:48 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 26 Jul 2018 21:09:48 +0000 (UTC)
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
 Thunderbird/52.9.1
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCZ6RLW3UIKBBGHS5DNAKGQE6NON3ZA@isocpp.org Thu Jul 26 23:09:44 2018
Return-path: <std-proposals+bncBCZ6RLW3UIKBBGHS5DNAKGQE6NON3ZA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lj1-f200.google.com ([209.85.208.200])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCZ6RLW3UIKBBGHS5DNAKGQE6NON3ZA@isocpp.org>)
	id 1finW3-0005e0-3x
	for gclcip-std-proposals@m.gmane.org; Thu, 26 Jul 2018 23:09:43 +0200
Original-Received: by mail-lj1-f200.google.com with SMTP id p8-v6sf665427ljg.10
        for <gclcip-std-proposals@m.gmane.org>; Thu, 26 Jul 2018 14:11:54 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1532639514; cv=pass;
        d=google.com; s=arc-20160816;
        b=IYdXi80iWDWt4fySRUXtEf9jV2jjfiMrnEmxnzqKNb5co6/Tf4sIm/f3rHql/QMjCF
         S3YivYiUJtkgeN+MqFKCwat34wNDmWGd/T46rZM78WDJ7EAGhkK7GWs3XH+1fo3dmqRR
         b+YZA3apMHSF1xG9TeiIhH0srXc8GL5f8jk7TLfQWk5UNNJlTxo9G9tKr3gdzIybGkVV
         waQWC6BGMo4u2ack/Qxmt64jP4YiqZyWRG6QgoLW/aSExr1PBT3AamjqlJIF3x2Z3aF5
         VrOZQFMUUbDVU96X+IvS0Xun/B53lfBhhYh5FILPyO9gXVC0qxknxxGe0yUp5dy9k95y
         PziA==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:content-language
         :in-reply-to:user-agent:mime-version:references:message-id:lines
         :date:subject:from:to:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=aKQnZYrKI0IAcr3HxlcJKDtQsrOnSqx/KZmg5jbOlxY=;
        b=Xjo0lZmUjzPHc0cua1Y+AWAoZulf46i/baMAvHXpzj+ihYoQajTtkLiECG9B69MuA3
         B9cVDS8diD4lXmXmuw1UpYCsQ/UmGPkWJbSobFO4e1TkwwxYNRNCRYHKPKj3TSruSDN/
         PMX9dvpgy+laEEPjG5okhNiaexOymeeCv7z+9RiD7AxpvrQyJ7G3IGzDpavUqwFNyTQM
         FgzqB5ifOz30zYd9JJNm2A7etYQHgOo2hUdux2F1ulutY+gyy8tJZY7rnS2EMar1tspf
         ZvTXfDLUEYGwL2+4ctzHfBmMaeVsdlvTTowQaGfCEhxY4SpTgRuDXdbYkJ8zVNg7Zcf+
         +VgQ 
ARC-Authentication-Results: i=2; mx.google.com;
       spf=neutral (google.com: 195.159.176.226 is neither permitted nor denied by best guess record for domain of gclcip-std-proposals@m.gmane.org) smtp.mailfrom=gclcip-std-proposals@m.gmane.org
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=to:from:subject:date:lines:message-id:references:mime-version
         :user-agent:in-reply-to:content-language:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=aKQnZYrKI0IAcr3HxlcJKDtQsrOnSqx/KZmg5jbOlxY=;
        b=YS1Wvrlt+8lVcH6U81WVc7rMoH/3FpqMMU3+9LiFfl70cmEY/iOyIz4e7ruk9YEcv9
         swtUxhkzLTsUT90TT/znIQeQxOr5XWSac7r8f2lF1hjB5CQHyGtsljTJC4v1gKFwP7PM
         pXG95dvknSpJbEa5zGMN+v+kJx55/cObprKoh+LfoJw/b7EB8U3GAZh9Rh1cLP9e9eRw
         M5jr2ocKdQvqJOhyYwRdRkBj/ODtHuoCxdXZUnPbBrhuREG1Ar4Bkke4dA0leB+xB0Fr
         g/sMXPHJVhYnG4kX2V5fUsqkReFJc5THFYzZeJRyaXM6kviBGbKL9s3ytmoNW4+ohMuq
         vQYA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:to:from:subject:date:lines:message-id:references
         :mime-version:user-agent:in-reply-to:content-language
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=aKQnZYrKI0IAcr3HxlcJKDtQsrOnSqx/KZmg5jbOlxY=;
        b=ftEJXFCZ7G2wxtpus9ydyM56fHWn8ngBefsENjE6dAIsbrNom9YTUwPlc6rz2Hh0o8
         UVdejH7AFBaNeSUz2mWh1Ne1STuS5lDjA1PdXN90Z1hFy50FNAzeT8LAACM5Oea+Pydm
         VbOp+jCNlkDdnK0QVaJk97vjWIDB5l1DMr26Ryo9j+rCq5YSuFSzGVMzGqzpj3OA8sMr
         Xa6XobDaYB6CPjU3ilZv8daFiBGANvemz1jQy1oWf5O37G7oc6R25VUXJZAj60tDrMgU
         +Uvd6syOMWzRvYxCE5LDLZBq7NyHaNRWhaeD18HPeBaPS025F95KgTzahZT78DzTsr2v
     
X-Gm-Message-State: AOUpUlFqZBYlvgyVKe6cSKIbPW2gM4kwIssnizyfsEkbDyoJqEcuhkh8
	K4Ox+GPf3oqdOZkpzr9MKPU=
X-Google-Smtp-Source: AAOMgpfrxWE9tSdV4Qm7eYyjGq4OayVQbzRhZZqdO1dbHq65muV8RpyMSz/RqIsEOgvVlmaScuy++A==
X-Received: by 2002:a2e:8057:: with SMTP id p23-v6mr246273ljg.29.1532639514307;
        Thu, 26 Jul 2018 14:11:54 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a19:4d12:: with SMTP id a18-v6ls67842lfb.14.gmail; Thu, 26
 Jul 2018 14:11:52 -0700 (PDT)
X-Received: by 2002:a19:e546:: with SMTP id c67-v6mr2307753lfh.135.1532639512365;
        Thu, 26 Jul 2018 14:11:52 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1532639512; cv=none;
        d=google.com; s=arc-20160816;
        b=stLNBxt3QUsYXUc3c2/EmwPNtDaCFQWWhWonQYhs7QwLAatB6KUQiB50ky1AeHdSmp
         WeI+ces2PkVBRolP4dBV4txeR+R7WrhdFMpn+mPLCAwmMhUFI3j4DQQphMtoDrAW8+Rd
         fJeEe8ZtQCVvfgLFR4stahoHQ5vApdpSGPbHsgdQoPqSq8R+47vgOiV/VGJx+3ZmYcZp
         J/hhnyo5VYQTNGRTIOZAuU07uTMNYUhMxFIAjPJr4zIi/8V0S6uwEkGPtddxUwQNOje0
         CmO6ctymPDWSze3TCsME+4SO11fQv06QGg4Q3x5PSpX5lebwfOhG51bq7/zWJwVdO5qP
         C1JQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-language:in-reply-to:user-agent:content-transfer-encoding
         :mime-version:references:message-id:lines:date:subject:from:to
         :arc-authentication-results;
        bh=oYl5222BvSLmjqO04i+eDo4VuwC6Nrk39QOhi8JnS2E=;
        b=TSUlJeDOU08ixlm41K+xBXemp9zGBpCoN7tZzXax8y+QM2TKxxBJ5ichoW+NGGC/SN
         R/40zcx+gMGpeATbhhiHUroG7kePRzSUAbB6uv00dW721HF3SXBuxVBCnlgleDAuK+k0
         X41WJesvAbowh+yFN/eGj3QVmjOPWerdzawjgON9pRooKT3yTHEg24pCNmFdt1t8Uzx4
         7yNKmsSVxq9j7oi0hX62unwPuZ0O/T2uKFr3sTV/DFOdgW3Xq6nUFMPW+LFtcVZMghQT
         A2QKhEsSN8TCHD/kExDf4i/rZ8KYg+4BujH5Jw9eomeq2epkOOYNW+m3Owu15T/VJ6PR
         3Kbw==
ARC-Authentication-Results: i=1; mx.google.com;
       spf=neutral (google.com: 195.159.176.226 is neither permitted nor denied by best guess record for domain of gclcip-std-proposals@m.gmane.org) smtp.mailfrom=gclcip-std-proposals@m.gmane.org
Original-Received: from blaine.gmane.org ([195.159.176.226])
        by mx.google.com with ESMTPS id k10-v6si772790lfk.237.2018.07.26.14.11.52
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Thu, 26 Jul 2018 14:11:52 -0700 (PDT)
Received-SPF: neutral (google.com: 195.159.176.226 is neither permitted nor denied by best guess record for domain of gclcip-std-proposals@m.gmane.org) client-ip=195.159.176.226;
Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2)
	(envelope-from <gclcip-std-proposals@m.gmane.org>)
	id 1finVz-0005Z8-De
	for std-proposals@isocpp.org; Thu, 26 Jul 2018 23:09:39 +0200
X-Injected-Via-Gmane: http://gmane.org/
Original-Lines: 45
Original-X-Complaints-To: usenet@blaine.gmane.org
In-Reply-To: <b39be2a8-c0c4-4887-a4ad-d11a50107aa9@isocpp.org>
Content-Language: sv
X-Original-Sender: gclcip-std-proposals@m.gmane.org
X-Original-Authentication-Results: mx.google.com;       spf=neutral
 (google.com: 195.159.176.226 is neither permitted nor denied by best guess
 record for domain of gclcip-std-proposals@m.gmane.org) smtp.mailfrom=gclcip-std-proposals@m.gmane.org
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:39422
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/39422>

On 2018-07-26 22:02, 'Hamza Sood' via ISO C++ Standard - Future 
Proposals wrote:
> If I'm interpreting the current draft standard correctly, it looks like 
> contract attributes don't work particularly well with trailing return types.
> 
> E.g. here's an example from the proposal, re-written with a trailing 
> return type:
> |
> 
> *auto f(intx,inty)
> [[expects:x>0]]
> [[expects:y!=0]]
> [[ensures result:result >x+y]]->int;
> *
> 
> |
> 
> The return type ends up really far away from the rest of the function 
> declaration, which makes it very difficult to spot.
> 
> I think it'd be better if contract attributes applied to a trailing 
> return type are considered part of the function declaration, which would 
> mean that the above could be written as:
> |
> 
> *auto f(intx,inty)->int
> [[expects:x>0]]
> [[expects:y!=0]]
> [[ensures result:result >x+y]];*
> 
> |

On the other hand, you can alredy have

template<class... Types> auto f(Types&&... x) const volatile && 
noexcept(std::conjunction_v<std::is_nothrow_move_constructible<Types>...>) 
-> int;


So why not add some more stuff before the -> ?  :-)

Or perhaps we need a general cleanup here, not just for contracts?


     Bo Persson

-- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/pjddad%24kii%241%40blaine.gmane.org.

.
