220 33541 <aec5f733-d43e-4d75-b001-0a0e9d49217f@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Nicol Bolas <jmckesson@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Catch block for multiple exceptions
Date: Wed, 2 Aug 2017 11:47:28 -0700 (PDT)
Lines: 97
Approved: news@gmane.org
Message-ID: <aec5f733-d43e-4d75-b001-0a0e9d49217f@isocpp.org>
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> <CA+fGSbMB3=H4hetWu3GFPzUskLP_sh0Q=Q4oxsUsZ6ci-jrpxg@mail.gmail.com>
 <CAFk2RUbdEQMQB4qLCDeaHeF0Q4ntbZG7-Cuf0X2G8d5+Dpf1Pw@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_3380_1459456279.1501699649030"
X-Trace: blaine.gmane.org 1501699651 6077 195.159.176.226 (2 Aug 2017 18:47:31 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 2 Aug 2017 18:47:31 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCEKFTV6ZUMBBQN4RDGAKGQEWYXWKHQ@isocpp.org Wed Aug 02 20:47:26 2017
Return-path: <std-proposals+bncBCEKFTV6ZUMBBQN4RDGAKGQEWYXWKHQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ua0-f199.google.com ([209.85.217.199])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBBQN4RDGAKGQEWYXWKHQ@isocpp.org>)
	id 1dcyg1-0001D7-0y
	for gclcip-std-proposals@m.gmane.org; Wed, 02 Aug 2017 20:47:25 +0200
Original-Received: by mail-ua0-f199.google.com with SMTP id x24sf19699023uah.7
        for <gclcip-std-proposals@m.gmane.org>; Wed, 02 Aug 2017 11:47:31 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=9oa6Wor6+XGfVWQLrHHus38RU7eUlBzA4kni5xMWhBc=;
        b=cClm6jFcwHL0Y8PpoaNJ9dlfi64fpSqtLsV3uVLg1H38BIuErUQ+cNMdCZONrBl3R/
         UIrDjEiCKGKgeBCFomf3dmIsDbnC9b7TsdTCZ1LNGUaXBBEhd90AUjOV77s6wjpEggF7
         YH36qGMi76T5qKs2C14De6uRwnezM7uKsRCHonp5HZwrkPfAw7k/e2Y3PQbhJjutJBfc
         SGBuOy7Yo0Eowu+FFN61cYiznf/+cBSoDoCmJFztVkjSE9p3lW3+U26QryOLRKpOguD3
         lSNpukn0KcVjFq/Dyk7yTzw9qbi8uqEzd4bFlK/kRFS0LN6h+TlZZC2C4gyX3R9n7UUi
         8Yog==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=9oa6Wor6+XGfVWQLrHHus38RU7eUlBzA4kni5xMWhBc=;
        b=WrE8r3wJgcRlaekySH1kvXB97q7ASY3o++q31yuV4l6kG1dvQ0dZEyRBzlQeDVOHp+
         MqRxgy7paL+EE8vzuBFu9iD7QrBRCcrqQGz4kT/cGCPXoaz4dSsW7EACDpAk7Nu7dl+x
         07bZZd7pdak8peVsDvyN7nByc0axIlcDzYFuZL6ldNlDPbxH85F61PCTIokDaJvDaXmB
         5Bf1gBne5mvHB0wC3qrZENFqoQXVZrhwjFYf/pcw4DezDJtG4hqbdbcbm4a8xhECxQ40
         0iJpgLtga67DB5h9UfvCHac6m+ZvT0sPpOJMXwpX1z5F/xpHb5BsFyWmHJQNDc4ixK9t
         V4nQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:x-original-sender:reply-to:precedence
         :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=9oa6Wor6+XGfVWQLrHHus38RU7eUlBzA4kni5xMWhBc=;
        b=JL+gz2yhPGBkqwmxqPhuTIl6yUPEncu2rlJLAz9yRViVYMDK0QHfeGZdMJhCFhGJsL
         8DudC+RFuE+7Oc3389Qs369+XW75xYo5vEGv80v9YnbiNPHFpDc7bX1NmU1BfeqrCFlG
         xGTUWKWybLkY+XtseEd3L2RC0DN1p9HKG0xKM3JBJOqby2kocpIvfF97h6lkJSJNnchZ
         DJyKLbmK9LbaAOGNxP7fFp/KNPHqmV3XKjQGkmu+Bt+PsRj+6DSubZx9vfCecItNaihd
         f6OBBx8LRufBczGgNgMmsgIgMSkBBzVzheKoBlKIIrL2FNey0woPlqFLrMTJCi/Zaw2b
         3Tsg==
X-Gm-Message-State: AIVw113twTdWiaDLk0ptn8aeHeKKxlcEao6NI+7xhTHZoYyD2PnwT6ta
	kDDeXgC2FnR1yzDf
X-Received: by 10.31.179.83 with SMTP id c80mr14557602vkf.60.1501699650838;
        Wed, 02 Aug 2017 11:47:30 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.146.87 with SMTP id u84ls7156iod.11.gmail; Wed, 02 Aug
 2017 11:47:29 -0700 (PDT)
X-Received: by 10.31.142.14 with SMTP id q14mr72378vkd.19.1501699649443;
        Wed, 02 Aug 2017 11:47:29 -0700 (PDT)
In-Reply-To: <CAFk2RUbdEQMQB4qLCDeaHeF0Q4ntbZG7-Cuf0X2G8d5+Dpf1Pw@mail.gmail.com>
X-Original-Sender: jmckesson@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:33541
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/33541>

------=_Part_3380_1459456279.1501699649030
Content-Type: multipart/alternative; 
	boundary="----=_Part_3381_1107108792.1501699649030"

------=_Part_3381_1107108792.1501699649030
Content-Type: text/plain; charset="UTF-8"



On Wednesday, August 2, 2017 at 2:40:35 PM UTC-4, Ville Voutilainen wrote:
>
> On 2 August 2017 at 21:05, Ricardo Fabiano de Andrade 
> <ricardofabi...@gmail.com <javascript:>> wrote: 
> > Hum, a template... bikeshedding an alternate syntax: 
> > 
> > catch<exceptionA, exceptionB, exceptionC>(auto& e) { 
> >  ... do something 
> > } 
>
>
> Boo hiss. Let's just write a solution with the toys C++17 gives us. 
>

That is a truly hideous stream of code. But I imagine that this situation 
is so rare that a "hideous stream of code" is probably not a terrible idea 
for a solution.

However, I think a small library feature could help make it less painful. 
Right now, we have `current_exception`, which gives us an `exception_ptr`, 
which is completely type-erased. We could give `exception_ptr` a way to 
un-erase the type. After all, the implementation has to have that type 
somewhere, since we can throw and re-catch it.

So perhaps an `any_cast`-like mechanism, that returns either `nullptr` or a 
pointer to the exception object. Only it should work as if it were a 
`dynamic_cast`. Then, we could implement an `exception_visitor` that takes 
a sequence of types and tries them, in order.

-- 
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/aec5f733-d43e-4d75-b001-0a0e9d49217f%40isocpp.org.

------=_Part_3381_1107108792.1501699649030
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Wednesday, August 2, 2017 at 2:40:35 PM UTC-4, =
Ville Voutilainen wrote:<blockquote class=3D"gmail_quote" style=3D"margin: =
0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On 2 A=
ugust 2017 at 21:05, Ricardo Fabiano de Andrade
<br>&lt;<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
hISI7gbZBQAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascript:&=
#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;return true=
;">ricardofabi...@<wbr>gmail.com</a>&gt; wrote:
<br>&gt; Hum, a template... bikeshedding an alternate syntax:
<br>&gt;
<br>&gt; catch&lt;exceptionA, exceptionB, exceptionC&gt;(auto&amp; e) {
<br>&gt; =C2=A0... do something
<br>&gt; }
<br>
<br>
<br>Boo hiss. Let&#39;s just write a solution with the toys C++17 gives us.
<br></blockquote><div><br>That is a truly hideous stream of code. But I ima=
gine that this situation is so rare that a &quot;hideous stream of code&quo=
t; is probably not a terrible idea for a solution.<br><br>However, I think =
a small library feature could help make it less painful. Right now, we have=
 `current_exception`, which gives us an `exception_ptr`, which is completel=
y type-erased. We could give `exception_ptr` a way to un-erase the type. Af=
ter all, the implementation has to have that type somewhere, since we can t=
hrow and re-catch it.<br><br>So perhaps an `any_cast`-like mechanism, that =
returns either `nullptr` or a pointer to the exception object. Only it shou=
ld work as if it were a `dynamic_cast`. Then, we could implement an `except=
ion_visitor` that takes a sequence of types and tries them, in order.</div>=
</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/aec5f733-d43e-4d75-b001-0a0e9d49217f%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/aec5f733-d43e-4d75-b001-0a0e9d49217f=
%40isocpp.org</a>.<br />

------=_Part_3381_1107108792.1501699649030--

------=_Part_3380_1459456279.1501699649030--

.
