220 33539 <CA+fGSbMB3=H4hetWu3GFPzUskLP_sh0Q=Q4oxsUsZ6ci-jrpxg@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Ricardo Fabiano de Andrade <ricardofabianodeandrade@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Catch block for multiple exceptions
Date: Wed, 2 Aug 2017 13:05:30 -0500
Lines: 123
Approved: news@gmane.org
Message-ID: <CA+fGSbMB3=H4hetWu3GFPzUskLP_sh0Q=Q4oxsUsZ6ci-jrpxg@mail.gmail.com>
References: <effe744d-f832-42c7-9b2a-ef31551067d0@isocpp.org>
 <deaedeb0-a699-49e9-826a-c41e674902c0@isocpp.org> <CAEfefmzCWDwP2ha7UfvvPrW_56TT4DEgvwRyxWm=6gS_GZc7pA@mail.gmail.com>
 <4126837.jZlGhgVnua@tjmaciei-mobl1> <d14636de-fb57-47b3-8666-7976ccdb6fe8@isocpp.org>
 <d58143f8-c128-3745-b835-1e04a5760d0d@gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="001a114eccbc06e71a0555c91c88"
X-Trace: blaine.gmane.org 1501697132 5758 195.159.176.226 (2 Aug 2017 18:05:32 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 2 Aug 2017 18:05:32 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCJN7V7TRQMBB25IRDGAKGQEGTGECII@isocpp.org Wed Aug 02 20:05:27 2017
Return-path: <std-proposals+bncBCJN7V7TRQMBB25IRDGAKGQEGTGECII@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pf0-f200.google.com ([209.85.192.200])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCJN7V7TRQMBB25IRDGAKGQEGTGECII@isocpp.org>)
	id 1dcy1O-00018y-Iz
	for gclcip-std-proposals@m.gmane.org; Wed, 02 Aug 2017 20:05:26 +0200
Original-Received: by mail-pf0-f200.google.com with SMTP id j83sf52994855pfe.10
        for <gclcip-std-proposals@m.gmane.org>; Wed, 02 Aug 2017 11:05:32 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1501697132; cv=pass;
        d=google.com; s=arc-20160816;
        b=Q22JdmTF3XZ4/+RQ/yM859sQpfz9Ut5bxcu8XQE26p3mLd7ZhGB3HvjsX/AkHsP0Q8
         1shT+MFfwE5u3nCWw7b7hAZuwYX8Lve6QUUyDgKnHWjgVjvtPwoMgYALgEua6dKWENnc
         lvxGhNv+Zh/Gb6ZLd6Rc2Da4RPftMXWMuaf8cPgaM4b5UaV6tNAAY03IbHfKO+E282yM
         e614cj3zX89VKrDPltClnOXqQ9SPWvwFWxiyJQxmW/yyi8RoptcRMUB0e0ZkB9IrHSX5
         tkZYKVxzcIy8yv/Us6ViEacJy4BalXXvVsKms6TWOCtBCA8iwHpbpeg5XkhXdZFglzt2
         ITRw==
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:to:subject:message-id:date
         :from:references:in-reply-to:mime-version:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=ND1pzuAWdfYFsIHO2lAX2KuI7PzYPWqG99CJgXWtM/c=;
        b=EBKxUKRv5AfFSn1zEx1iRB8WXk6wc6W7L2Gno539j6Rgt1aFUWQg90utdKjivTbcix
         efR8FNATblFXz/nbyYA19PbKYqr1X+AW04ggCtR2YnL7Rf2OpXOEQ+y7Fc/Lz1EC3fp0
         4wzsp5e/riiirEqLUKHHGHx2DDOqic0lrOmAH1+dKlML04izZ0fOli3GKHwIkG5CdeiI
         YkzMymBl4NpyrXLz5iswOIEi6aRjVOwacbRq1Zin71YFBulpo/arWxONQw1h2y+UtLSZ
         BjAyNNT41ev1uYdzlw10wo5neozPBMpoFrds+Js8PmBYOJZKbqgKlMtz7Dgd5Ss9PGs5
         NOeA==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.b=BeGZ1APL;
       spf=pass (google.com: domain of ricardofabianodeandrade@gmail.com designates 2607:f8b0:400c:c05::22d as permitted sender) smtp.mailfrom=ricardofabianodeandrade@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
         :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=ND1pzuAWdfYFsIHO2lAX2KuI7PzYPWqG99CJgXWtM/c=;
        b=RR4o/Elw5kSA8vJnL62KfdYdQZfln6vfA8BfksOK8btaVqWx/ev+S+DelJp7NGjFjI
         9ZDbYZVbavqADyolrqXwXRm+is/WCOj26ZnUYN6qA1VYoze8n4hyasseuiq/lW+iWwuj
         72sujfKI1teaI5f9tpjKcF0Mc81Nq+db03r7NUXxwT6rH0vNX0cPwOB3DubACAyoaDT2
         Cg7T2ePhjK6oqvRN3c5HXa5qFDc18x4uYPkrLTjw2iKgaGHOPZWSHjC9OM2PWzyjG0JU
         q56QEMXtG669NpXBmL1lBgOMHV+GvN09pNrWqNp/P2csmqiaJGfsabWXt3FYuohF9lme
         5Bow==
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: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=ND1pzuAWdfYFsIHO2lAX2KuI7PzYPWqG99CJgXWtM/c=;
        b=Y4Ft/smSwUznWYcrauaNKtcOWRTKZJKqS2aVvs6xG/DH4hyHLfJHFcUhZ1UK+leBGY
         8xEFGahJ+VRU+O5V2iBR5mPoRrmy5oNzgRwAGMu5Y1dz+GEOliMAvJUWTMHp+mreG7cm
         zoDrEX5mBBEKne5iDD0pLfsAWYLpl6B1Bhg1+FuIKkRs85LyX+TGpslO8IBal1GuAhpo
         BuMJMWUjLmv4khTkZpy8yMhVh+4SkybV/+AOKgaxdTXqpR+KUOMRMJHekYehig5Sap+d
         LXLQWiCYxEFNpftBJGyIpShZhzseJKzE58nLt/2Yg+BpAjMFWyblwOLgjCJD9FZnc6xK
         x2Pw==
X-Gm-Message-State: AIVw112uX2r4HSdeuEe9w6HY9XD0NR4x9Qd3kMp44vOXjBaS9eEGFGyu
	mPGaoDCJCyzupYyJ
X-Received: by 10.98.7.90 with SMTP id b87mr15206966pfd.43.1501697132249;
        Wed, 02 Aug 2017 11:05:32 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.36.36.202 with SMTP id f193ls3419769ita.17.canary-gmail; Wed,
 02 Aug 2017 11:05:31 -0700 (PDT)
X-Received: by 10.176.4.111 with SMTP id 102mr18541200uav.146.1501697130984;
        Wed, 02 Aug 2017 11:05:30 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1501697130; cv=none;
        d=google.com; s=arc-20160816;
        b=V8pzcoKFFBGmvwbleU0CPwp6+ezhTl4j2A67rXCqZkeJXDajL8VHaIqsrAavMbwMih
         k5pI+2VBEA4Vq5NEA5Uert7IXJHaPvtkyVHVyF2+2v62IOuZESTm5aUd3k68K588ZMrb
         DOZP0fNqgi3tKzH4PMNraDUB2tCKjkqReu9nQ9Adm8D7xfPNADCX6IOSXJzrZiVVaBHX
         t6c/MXvy7kH5w9Lmq1nc7+0LvbIlsyrVUOeCrN/JN7whF1+fJRcR3weDu3u2x/4QwTvj
         h79y+mlOR/ZqewHRMBzKhB5tgQn/FBS9DJ3uo4y0YHWDCgUXPYutDQupPtcLjXaY0NBC
         N9DQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=to:subject:message-id:date:from:references:in-reply-to:mime-version
         :dkim-signature:arc-authentication-results;
        bh=7Lo2Nn5YyvTTLcVWPdiLb6e4+xeorrUqQBE4q+rQPkA=;
        b=Z5XSIXFZ2DfG8HOgA4jJQO9jH3x/s8VLnHzif4iyHT37Jn/7pLiBYyEipAOBhuYyNO
         7o2wD7s/f3RkFd9v9p7UpD5I7mzmi0OvPNVAulDxvxvjGTrbnEiGMb5TSULwe4/azTOm
         pOwoQpoN8WxNhdG768j8I9eSiR1tVHjl2HsvZDbv+dHdZdyiPEJwmJDPhSVaa/FFszDD
         QStF/7Riyh7KXPPMRXHRnJLSRChCtgXYEEw3UHIadKf74vVwZISjfrST8crFx34zFAtv
         ZHX0mGB00sdm5Leu3gGwJAQz8KKHmFn7diknsZLbHpmy6YaSiMpZtT8Pk2vQqf7Lmn7z
         81aA==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.b=BeGZ1APL;
       spf=pass (google.com: domain of ricardofabianodeandrade@gmail.com designates 2607:f8b0:400c:c05::22d as permitted sender) smtp.mailfrom=ricardofabianodeandrade@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com
Original-Received: from mail-vk0-x22d.google.com (mail-vk0-x22d.google.com. [2607:f8b0:400c:c05::22d])
        by mx.google.com with ESMTPS id b28si3491960uaa.136.2017.08.02.11.05.30
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Wed, 02 Aug 2017 11:05:30 -0700 (PDT)
Received-SPF: pass (google.com: domain of ricardofabianodeandrade@gmail.com designates 2607:f8b0:400c:c05::22d as permitted sender) client-ip=2607:f8b0:400c:c05::22d;
Original-Received: by mail-vk0-x22d.google.com with SMTP id x10so20961878vkd.0
        for <std-proposals@isocpp.org>; Wed, 02 Aug 2017 11:05:30 -0700 (PDT)
X-Received: by 10.31.215.6 with SMTP id o6mr9751825vkg.179.1501697130553; Wed,
 02 Aug 2017 11:05:30 -0700 (PDT)
Original-Received: by 10.176.25.101 with HTTP; Wed, 2 Aug 2017 11:05:30 -0700 (PDT)
In-Reply-To: <d58143f8-c128-3745-b835-1e04a5760d0d@gmail.com>
X-Original-Sender: ricardofabianodeandrade@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.b=BeGZ1APL;       spf=pass (google.com: domain of
 ricardofabianodeandrade@gmail.com designates 2607:f8b0:400c:c05::22d as
 permitted sender) smtp.mailfrom=ricardofabianodeandrade@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:33539
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/33539>

--001a114eccbc06e71a0555c91c88
Content-Type: text/plain; charset="UTF-8"

Hum, a template... bikeshedding an alternate syntax:

catch<exceptionA, exceptionB, exceptionC>(auto& e) {
 ... do something
}

On Wed, Aug 2, 2017 at 8:38 AM, Matthew Woehlke <mwoehlke.floss@gmail.com>
wrote:

> On 2017-08-02 08:47, Barry Revzin wrote:
> >> And how to know which one invoked? You don't. If you wanted to know if
> it
> >> was exceptionA, you'd add a catch block for it.
> >
> > You'd almost want something like:
> >
> > catch (variant<exceptionA&, exceptionB&, exceptionC&> e) {
> >     visit([](auto& e){ f(e); }, e);
> > }
>
>   catch (exceptionA, exceptionB, exceptionC e) {
>     if constexpr (std::is_same_type_t<decltype(e), exceptionA>) {
>       ...do something with exceptionA...
>     }
>   }
>
> IOW, implement such blocks sort of like templates; write the code once,
> but the compiler internally converts it to separate catch-blocks with
> the same bodies.
>
> --
> Matthew
>
> --
> 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/d58143f8-c128-3745-
> b835-1e04a5760d0d%40gmail.com.
>

-- 
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/CA%2BfGSbMB3%3DH4hetWu3GFPzUskLP_sh0Q%3DQ4oxsUsZ6ci-jrpxg%40mail.gmail.com.

--001a114eccbc06e71a0555c91c88
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hum, a template... bikeshedding an alternate syntax:<div><=
br></div><div>catch&lt;exceptionA, exceptionB, exceptionC&gt;(auto&amp; e) =
{</div><div>=C2=A0... do something</div><div>}</div></div><div class=3D"gma=
il_extra"><br><div class=3D"gmail_quote">On Wed, Aug 2, 2017 at 8:38 AM, Ma=
tthew Woehlke <span dir=3D"ltr">&lt;<a href=3D"mailto:mwoehlke.floss@gmail.=
com" target=3D"_blank">mwoehlke.floss@gmail.com</a>&gt;</span> wrote:<br><b=
lockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px =
#ccc solid;padding-left:1ex">On 2017-08-02 08:47, Barry Revzin wrote:<br>
&gt;&gt; And how to know which one invoked? You don&#39;t. If you wanted to=
 know if it<br>
&gt;&gt; was exceptionA, you&#39;d add a catch block for it.<br>
&gt;<br>
&gt; You&#39;d almost want something like:<br>
&gt;<br>
&gt; catch (variant&lt;exceptionA&amp;, exceptionB&amp;, exceptionC&amp;&gt=
; e) {<br>
&gt;=C2=A0 =C2=A0 =C2=A0visit([](auto&amp; e){ f(e); }, e);<br>
&gt; }<br>
<br>
=C2=A0 catch (exceptionA, exceptionB, exceptionC e) {<br>
=C2=A0 =C2=A0 if constexpr (std::is_same_type_t&lt;decltype(<wbr>e), except=
ionA&gt;) {<br>
=C2=A0 =C2=A0 =C2=A0 ...do something with exceptionA...<br>
=C2=A0 =C2=A0 }<br>
=C2=A0 }<br>
<br>
IOW, implement such blocks sort of like templates; write the code once,<br>
but the compiler internally converts it to separate catch-blocks with<br>
the same bodies.<br>
<span class=3D"HOEnZb"><font color=3D"#888888"><br>
--<br>
Matthew<br>
<br>
--<br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org">std-propo=
sals+unsubscribe@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/d58143f8-c128-3745-b835-1e04a5760d0d%=
40gmail.com" rel=3D"noreferrer" target=3D"_blank">https://groups.google.com=
/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/d58143f8-c128-3745-<wbr>b835-=
1e04a5760d0d%40gmail.com</a>.<br>
</font></span></blockquote></div><br></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CA%2BfGSbMB3%3DH4hetWu3GFPzUskLP_sh0Q=
%3DQ4oxsUsZ6ci-jrpxg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoote=
r">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CA%2BfGSbMB=
3%3DH4hetWu3GFPzUskLP_sh0Q%3DQ4oxsUsZ6ci-jrpxg%40mail.gmail.com</a>.<br />

--001a114eccbc06e71a0555c91c88--

.
