220 34603 <CAFk2RUZcpy7Fy2YPf_55zjBdH_3SavqZb_guGwQizp-iUuK=hQ@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Ville Voutilainen <ville.voutilainen@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: D0779R0: Proposing operator try() draft 1 paper
Date: Wed, 4 Oct 2017 23:55:08 +0300
Lines: 92
Approved: news@gmane.org
Message-ID: <CAFk2RUZcpy7Fy2YPf_55zjBdH_3SavqZb_guGwQizp-iUuK=hQ@mail.gmail.com>
References: <13df2242-f7dd-405d-b8b9-23b47981c56e@isocpp.org>
 <59D4D462.9040106@gmx.net> <CAFk2RUbWu1Pgdnm9o49cjrhd__5Ntn6bNFb_qCO3DWBQfev0jg@mail.gmail.com>
 <602e9e20-1d2f-4545-be32-d0234639985c@isocpp.org> <CAFk2RUbH2Y31ZdBfDOgzWcyu3vnz1CgpZBSxsu8wGdY8bhqCXA@mail.gmail.com>
 <229b9108-ece9-28a1-dbf5-c845e338f557@wanadoo.fr>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Trace: blaine.gmane.org 1507150508 12782 195.159.176.226 (4 Oct 2017 20:55:08 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 4 Oct 2017 20:55:08 +0000 (UTC)
Cc: "ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
To: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Original-X-From: std-proposals+bncBC5JHI7A7ALRBLMV2XHAKGQEVJZTWMQ@isocpp.org Wed Oct 04 22:55:04 2017
Return-path: <std-proposals+bncBC5JHI7A7ALRBLMV2XHAKGQEVJZTWMQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-it0-f70.google.com ([209.85.214.70])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBC5JHI7A7ALRBLMV2XHAKGQEVJZTWMQ@isocpp.org>)
	id 1dzqh5-0002gY-Fh
	for gclcip-std-proposals@m.gmane.org; Wed, 04 Oct 2017 22:55:03 +0200
Original-Received: by mail-it0-f70.google.com with SMTP id 142sf6871044ite.12
        for <gclcip-std-proposals@m.gmane.org>; Wed, 04 Oct 2017 13:55:11 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1507150510; cv=pass;
        d=google.com; s=arc-20160816;
        b=K0Pnyx2xXLuWNWtLCa6rYWi9Sk+hrjRzDX3yfbv1MOnM3JXn8EDLfyrnrbjQSK85is
         FzxAgr6BOZYP7y3bwUS0GOhdjekjDYBerXFKmsCUAdIMnQrCyHjI8XOh7TNQtm8TEk5E
         NP9NGjA9hj7QpizmO6V7wviUxCAr7gttViFR527TL49mOHPKA73f6JWtouONqzOPerW7
         HX58l6bhhueqcHYMcqvKDNIrYmfnRxXc3zcEUSTNfKuOLNM0+5wpu1ya2VcZBgjoZZdF
         cgA0VrcMBZjGvHlGmJTz1yd7gDUhKLzdxA0h0fuUvOcOe5gs/xWYFPenutNY27L0nwTP
         LVCA==
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-transfer-encoding
         :cc:to:subject:message-id:date:from:references:in-reply-to
         :mime-version:arc-authentication-results:arc-message-signature
         :dkim-signature:arc-authentication-results;
        bh=ub0JQYjElh8h5apg/jGh25WUsU7/2Z1+l4V/5pSezJI=;
        b=flSfmGenxNs7N9z5WNT/SDEh8Y0Y0pDf78WeMsGK5GTxdbgcH2+SM2B5dajNZOTp0U
         IIKyLCoBb1yFIqR0yJX1nZuQhxvQwqjEsvALj4Bvjj0LnbQ9QTlj3jBj7F40zFJka6Bt
         JsaE2JjQxRMHmsGDSaw/tAI0pLdsWkhu0A15Z+Yq1Vb3kOLkCdduIOogJTcCutIQuqJp
         3Xh/KrGXLsQ+FA8tfcN7y+N7bRsbxZAvFN1K99hCsNpWA45VL+O1J+JqOvNTNMGlCuJE
         p36e+R35xuL6b0Ub7cwObk3+0UKlpxzoqgbiDVOVKTaolk/RamM2qdEjEbf7Q8BUljZC
         20PA==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=C9Xtzm/t;
       spf=pass (google.com: domain of ville.voutilainen@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=ville.voutilainen@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:in-reply-to:references:from:date:message-id:subject:to
         :cc:content-transfer-encoding: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=ub0JQYjElh8h5apg/jGh25WUsU7/2Z1+l4V/5pSezJI=;
        b=DCgOBhag/6BaCcYLKPGQGhhPWIHp32oYKhau/sdMqt2JTa6wOP5fVZHcnUJ1kTp/si
         cplcqvno9EXvm9bTP4S9s+41HnC+7jFqMqz03ECIMk7gI+dQYBrOVEy6sK+ouBiJmn/h
         KqivcqBXXoi+qUVNIbt0lU1AXfIH5ykZ6b5hZWmY67v7p8NmYodmolYe3Ylkap08OzfU
         3T29EF77e0TOdgET7nVXKiK4uJ44cUOABPqVaeAl8i88wYySSg5aQK3YnJBNvCLDtQUb
         8YIkZofpK9qKUkhzgJj72NVwyUi/KKC6qSAL+9Lnd8Dw/7egTndUU2tpCUJz48w5H5tO
         +3Pg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:in-reply-to:references:from:date
         :message-id:subject:to:cc:content-transfer-encoding
         :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=ub0JQYjElh8h5apg/jGh25WUsU7/2Z1+l4V/5pSezJI=;
        b=L9LWSpiNszXMoGpYt2jRkLqoy0QXfKYefom36XSTq+6EpboX8vIhTA121CfWj2KNVw
         ohKL1MFmXZZcwEhJa+iUlIiAPtdzxEKS/IlfRtbcu+FAVnrovjazVHl0UgIW2OLveqNN
         gdj3MhZgp2UiQGeRWQDS74M2liMQPKY1sqnsFzt4FNuvMqR1XovFi7+n3H29iKBmDbcU
         grYAu64RJ7fQpcy/gLSybUQhaJUOWHHcJfGEoo5iEfZdqaBAQK3lPk1yCTEfmw3QNznj
         qPrpuBCkiKS5YIKZUCXuMkP+t9niQmO+J36NDHxiUOvBSIxmpJFN2PrOMoBgSx5evviy
          
X-Gm-Message-State: AMCzsaWCa7S2jttBO6uImueo4Vs9NuBpF123DubV2ihazHISfv2X8/Bt
	vDhAGLQYvA5UekNMue1hKX5rng==
X-Google-Smtp-Source: AOwi7QCKdBBQYGWJm3D6ENDnRwDwrtx6fTFM9ws4ioeYXHxedj3XWJvJTp2SOFxtiMwk7DP4SRtYcA==
X-Received: by 10.157.51.60 with SMTP id f57mr1077876otc.29.1507150510696;
        Wed, 04 Oct 2017 13:55:10 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.202.2.21 with SMTP id 21ls4361767oic.12.gmail; Wed, 04 Oct
 2017 13:55:09 -0700 (PDT)
X-Received: by 10.157.89.133 with SMTP id u5mr5110775oth.56.1507150509574;
        Wed, 04 Oct 2017 13:55:09 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1507150509; cv=none;
        d=google.com; s=arc-20160816;
        b=eqxlmJCKUnzwf7vRYMfqL6jNEgRCIjn9rpVy2QRGoAWJYOwQtyz2c3Tvf3ns4bX67H
         o9SLXPUYChQax2aNjN35aXcGmOG2P+T/AXQyPsJmj0Xo9zKx6lkeJsKQzxrkr7etLezo
         WMPG9CB/4kwJc27/kE5Uv/yZTpswFFFylvQ+iMw55HvDl5b46rGHMqhLHoZ6IhN0lHYQ
         UM5B/KoLa9EnZ4momosbkGZS0EgzCFindYAweEKN1HiPjtwCmmWeoltGNssqPEwj7O2D
         2uuccfD3Aj4H2C+tEQSCIPjr6EsiXhGo5rE4+bEkteAaYCq4dovxjpKVD1miFZW3ldtR
         E5Ag==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-transfer-encoding:cc:to:subject:message-id:date:from
         :references:in-reply-to:mime-version:dkim-signature
         :arc-authentication-results;
        bh=WJ44KxcpH+SSL5ZkgHthVL8LjvMZ2dJ4RuqP85gyfL4=;
        b=YzI39xnIl2MofN0BupT7mQ4iVFWgGJxZmbCV4cF7geqEcRlbF45O5REeuVzSuBmXsz
         gR+bD0rBiEHQeksTPxV7KwkpIcUBAN5b7sSGZPQAZgRGvo7h2VRcavxXxkbmJNIWRu9w
         t+YdSvvXnPWrCCzH9u1tXemPT3sSfP9bGDX9q7cPtkMdCwnq8tTS+5tyIXij0hHxKd8i
         rf8GyWCIljR3LB1ROnAAryDx8ieUqVQW/PMNTN4LFCRfHaZmtE9CPZvLR2S9SnibTJB4
         7OXn1XuBTpfkAb97vPoRJUpp3TzyiJxXm2MgL4Zl6qkNk0j0WQz/7jQVJ6tChmK1rjab
         xdXQ==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=C9Xtzm/t;
       spf=pass (google.com: domain of ville.voutilainen@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=ville.voutilainen@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com
Original-Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41])
        by mx.google.com with SMTPS id p63sor2183881oib.201.2017.10.04.13.55.09
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Wed, 04 Oct 2017 13:55:09 -0700 (PDT)
Received-SPF: pass (google.com: domain of ville.voutilainen@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 10.202.189.137 with SMTP id n131mr9862845oif.126.1507150509214;
 Wed, 04 Oct 2017 13:55:09 -0700 (PDT)
Original-Received: by 10.157.2.132 with HTTP; Wed, 4 Oct 2017 13:55:08 -0700 (PDT)
In-Reply-To: <229b9108-ece9-28a1-dbf5-c845e338f557@wanadoo.fr>
X-Original-Sender: ville.voutilainen@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=C9Xtzm/t;       spf=pass
 (google.com: domain of ville.voutilainen@gmail.com designates 209.85.220.41
 as permitted sender) smtp.mailfrom=ville.voutilainen@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <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:34603
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/34603>

On 4 October 2017 at 23:11, Vicente J. Botet Escriba
<vicente.botet@wanadoo.fr> wrote:
> Le 04/10/2017 =C3=A0 16:54, Ville Voutilainen a =C3=A9crit :
>>
>> On 4 October 2017 at 17:48, Nicol Bolas <jmckesson@gmail.com> wrote:
>>>>
>>>> Before we even go there, the paper needs to explain
>>>>
>>>> a) why this is a problem that needs to be solved
>
> When we want to propagate the failure or get the value the current code i=
s
> something like
>
>     auto res =3D expr();
>     if (! res) return unexpected(res.error());  // idealy this should be
> using the removed get_unexpected.
>
>
> When you have a lot of them nested in a expression , you need to extract =
the
> rerun logic outside the expression, e.g. if you need to add the result of
> two calculations
>
>     auto res1 =3D expr1();
>     if (! res1) return unexpected(res1.error());
>
>     auto res2 =3D expr2();
>     if (! res2) return unexpected(res2.error());
>
>     return *res1+ * res2
>
>
> Using the try expression we can just do
>
>     return try expr1()+ try expr2();
>
>
> Clearly the last is much more readable and express better the intent than
> the more elaborated code above.
>
> LESS CODE MORE SOFTWARE
> KISS
>
> Ville, is this the kind of motivation you are asking for?

No. The paper needs to explain why such code is so common that it
needs a core language facility
to help it.


>>> If you try to introduce a function that does what `try` does, it would =
be
>>> unable to do the one thing that makes `try` work: return. A function
>>> cannot
>>> force the calling function to return. You could make a macro that does
>>> what
>>> `try` does, but we have no way to do that within the language.
>>
>> Yes, well, perhaps we should look at adding something more general
>> than individual
>> keywords that perform specific transformations that then return (or
>> not) via a nettle bush
>> of traits and hooks.
>>
>
> Yes, maybe there is something generalizing co_await and try. I don't know=
..
> For me we need to go from concrete needs to more generic ones.
>
> Do you have an idea of what this generic thing could be?

Well, we could look at providing code transformation facilities
powerful enough that you
can provide what you need via a specific transformation. As a more limited =
idea,
there seems to be an occasional need to write operations that can exit
the surrounding
scope via break/continue/return, but functions can't do that, so
perhaps we could add
a block facility that can.

--=20
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 e=
mail 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/CAFk2RUZcpy7Fy2YPf_55zjBdH_3SavqZb_guGwQizp-iUuK=
%3DhQ%40mail.gmail.com.

.
