220 41266 <4fe7ab83-be8f-4f62-a1a4-72b39fb540d3@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Alberto Barbati <albertobarbati@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: constexpr also in switch() and even in for().
Date: Fri, 14 Dec 2018 01:20:28 -0800 (PST)
Lines: 82
Approved: news@gmane.org
Message-ID: <4fe7ab83-be8f-4f62-a1a4-72b39fb540d3@isocpp.org>
References: <18750262-f0ab-4330-ab08-29004735c6bb@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_684_675424228.1544779228798"
X-Trace: blaine.gmane.org 1544779106 22725 195.159.176.226 (14 Dec 2018 09:18:26 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 14 Dec 2018 09:18:26 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCPY5DV6RIMBBX7LZXQAKGQEJ5Y3A7Q@isocpp.org Fri Dec 14 10:18:22 2018
Return-path: <std-proposals+bncBCPY5DV6RIMBBX7LZXQAKGQEJ5Y3A7Q@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yw1-f71.google.com ([209.85.161.71])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCPY5DV6RIMBBX7LZXQAKGQEJ5Y3A7Q@isocpp.org>)
	id 1gXjbx-0005o1-UC
	for gclcip-std-proposals@m.gmane.org; Fri, 14 Dec 2018 10:18:22 +0100
Original-Received: by mail-yw1-f71.google.com with SMTP id l131sf2837670ywc.21
        for <gclcip-std-proposals@m.gmane.org>; Fri, 14 Dec 2018 01:20:32 -0800 (PST)
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=1JwY/h2t2owNnz5OGjiOdn5DEg1cD0xZ+eWRhCrqVOE=;
        b=fSD5JMGNVp9YS8kFM209r/EILa7s8MiyW0c4sDm+BEMdMQL1NWQ5f5XfuyGO5ghEg8
         T/iStIJG2qQ1CohbwyKjwRhN/hU8OX89sPBlo9YwDAWq9WaGzrTPif7Rm6UmdjvolvnQ
         luHzLhcr9lBS2i6UHlcAQQc8EqEPKu3QfBaEKdsaSg1+yVtrQOe5uIc8kiQQ6HvPzgFi
         nFd+TZyTzUAgbApRvZOPZJb0AJmkp02ndyAPQ6ndOs01WHiELOo/FnI/RVMsLhCpdkP/
         Boe6Kk9Qo0O5LPhdSN0JHfULwmirQfjlejG1IDSPYs44L08IwSDfKIfXlGsMuITeqG/B
         qrpQ==
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=1JwY/h2t2owNnz5OGjiOdn5DEg1cD0xZ+eWRhCrqVOE=;
        b=I4GLSAKnyuXuV0Jba91xiv6bQopIxqLVZb8gcu82v8O3BcODPI+l1m7tc0f4UZixGt
         7tAGIbxiXGtrvhZA7M/nGUdwPZqHJjCj8BqAZT6HxsKP1V5kvDh0qFZpEYjh6XxHeD51
         FNt1SObiENPKBQNtEApjb+xqYNgoWYDX5X6SzMlH+5848gAuYWh+k1PVpTgrrdrMyImK
         KRJO5hbBKEYTkbiX7HYBcIbq8DvnYyDClE3n4Wnsmt1tFjPABfxkgyM2SXQco8HTMtCR
         Q+vRUFRib594LXGY9aNsaysYVcyVVnJKhdUndx2o/1G3FcBHBvEVc22nuUUy7QdG7oKg
         ITEA==
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=1JwY/h2t2owNnz5OGjiOdn5DEg1cD0xZ+eWRhCrqVOE=;
        b=TbkXS8BvnVmubedtz+OqN0oqQ46d4VjGRcEAk3O+6bGSdoj8IVEOWVV56G+50Yw5Yt
         CsIw2Tbrhrim4SfelB2BnuEl76NfYW15pKUrVpZDaSW6BMWj1+Uv/lp86A0fIYwriUd/
         hU5pT9oYyHD+mpNi8XlLk/WsIMRAaDDTnYCL8geT+pWappbqo3+Nfr/HbD9oTXnYgobl
         WLtY0uQYuFERRjNAO3z6u9RuFfh5bdIqizIyp+/sTuITTQXhP4Y4HuigbnG8DHJWPvFK
         1tL+qFdMFE6sWzyQE2D5oLfalFT9WS/uXbIzZXFpRuQwn9hWIc2+4Xs0nYG2fnnBOoG4
         bt8Q==
X-Gm-Message-State: AA+aEWZR9fJLCqlHWTRj9t+Z5EBZSeT7FsLR/lhwDuEZR+QU841T+JAF
	9yYfnrErcTZ42y8ge+dBP0ws0Q==
X-Google-Smtp-Source: AFSGD/VmGSupF/edtoK9hrDrkZcDGMdmpJsTDijd/ts8+MJBBwPATgOFKGyPl2lWV9pyxIM7zldaGw==
X-Received: by 2002:a25:9d0f:: with SMTP id i15-v6mr1100188ybp.23.1544779232223;
        Fri, 14 Dec 2018 01:20:32 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a81:7589:: with SMTP id q131ls678685ywc.1.gmail; Fri, 14 Dec
 2018 01:20:30 -0800 (PST)
X-Received: by 2002:a81:450:: with SMTP id 77mr19204ywe.6.1544779229599;
        Fri, 14 Dec 2018 01:20:29 -0800 (PST)
In-Reply-To: <18750262-f0ab-4330-ab08-29004735c6bb@isocpp.org>
X-Original-Sender: AlbertoBarbati@gmail.com
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:41266
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/41266>

------=_Part_684_675424228.1544779228798
Content-Type: multipart/alternative; 
	boundary="----=_Part_685_365109050.1544779228798"

------=_Part_685_365109050.1544779228798
Content-Type: text/plain; charset="UTF-8"

Hi Frank,

I believe you are missing the point of "if constexpr". The real usefulness 
of "if constexpr" is that it makes the branch that is not selected a 
"discarded statement" so that it doesn't trigger compilation errors if it 
is ill-formed after template parameters substitution. In the case of the 
for statement, that usefulness simply isn't there, because there's only one 
statement to consider, so either it is ill-formed for all iterations or 
none of them. The idea of having the iteration variable constexpr is 
intriguing, but I'm not totally sure that it has a real usefulness, 
especially after the introduction of consteval functions. The switch 
statement is a bit more complicated, as its structure is too "flexible", 
with jumps at labels that may not respect scopes. Because of that a switch 
is *not* equivalent to a cascade of if-statements at least in the general 
case.

Anyway, your proposal indicates a possibile solution but doesn't describe a 
real problem that the proposal is trying to solve. I am afraid but "It 
would be nice to have this..." is not a satisfactory description of real 
problem.

Alberto


-- 
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/4fe7ab83-be8f-4f62-a1a4-72b39fb540d3%40isocpp.org.

------=_Part_685_365109050.1544779228798
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hi Frank,</div><div><br></div><div>I believe you are =
missing the point of &quot;if constexpr&quot;. The real usefulness of &quot=
;if constexpr&quot; is that it makes the branch that is not selected a &quo=
t;discarded statement&quot; so that it doesn&#39;t trigger compilation erro=
rs if it is ill-formed after template parameters substitution. In the case =
of the for statement, that usefulness simply isn&#39;t there, because there=
&#39;s only one statement to consider, so either it is ill-formed for all i=
terations or none of them. The idea of having the iteration variable conste=
xpr is intriguing, but I&#39;m not totally sure that it has a real usefulne=
ss, especially after the introduction of consteval functions. The switch st=
atement is a bit more complicated, as its structure is too &quot;flexible&q=
uot;, with jumps at labels that may not respect scopes. Because of that a s=
witch is *not* equivalent to a cascade of if-statements at least in the gen=
eral case.</div><div><br></div><div>Anyway, your proposal indicates a possi=
bile solution but doesn&#39;t describe a real problem that the proposal is =
trying to solve. I am afraid but &quot;<span style=3D"font-family:arial,san=
s-serif">It would be nice to have this...&quot; is not a satisfactory descr=
iption of real problem.<br></span></div><div><span style=3D"font-family:ari=
al,sans-serif"><br></span></div><div><span style=3D"font-family:arial,sans-=
serif">Alberto<br></span></div><br><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/4fe7ab83-be8f-4f62-a1a4-72b39fb540d3%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/4fe7ab83-be8f-4f62-a1a4-72b39fb540d3=
%40isocpp.org</a>.<br />

------=_Part_685_365109050.1544779228798--

------=_Part_684_675424228.1544779228798--

.
