220 19746 <383084B6-C962-4EFD-9F63-A643349DA12E@gmail.com> article
Path: news.gmane.org!not-for-mail
From: David Krauss <potswa@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: constexpr in the era of modules.
Date: Mon, 10 Aug 2015 20:14:25 +0800
Lines: 102
Approved: news@gmane.org
Message-ID: <383084B6-C962-4EFD-9F63-A643349DA12E@gmail.com>
References: <2671d071-9935-41fe-91d5-94423309267a@isocpp.org> <647AFA8B-6C17-44DD-9BB3-E9E0F7B9D0C6@gmail.com> <77b7c7d1-99f1-49be-925b-a43d7250fa71@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\))
Content-Type: multipart/alternative; boundary="Apple-Mail=_8981BCA6-500E-4BD7-8FFB-0E595BDB5431"
X-Trace: ger.gmane.org 1439208909 7287 80.91.229.3 (10 Aug 2015 12:15:09 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 10 Aug 2015 12:15:09 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCW25A7E3QCRBRVLUKXAKGQEKMAC7YY@isocpp.org Mon Aug 10 14:15:05 2015
Return-path: <std-proposals+bncBCW25A7E3QCRBRVLUKXAKGQEKMAC7YY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qk0-f199.google.com ([209.85.220.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCW25A7E3QCRBRVLUKXAKGQEKMAC7YY@isocpp.org>)
	id 1ZOlyq-0005Rj-6S
	for gclcip-std-proposals@m.gmane.org; Mon, 10 Aug 2015 14:15:04 +0200
Original-Received: by qkfn3 with SMTP id n3sf217542877qkf.3
        for <gclcip-std-proposals@m.gmane.org>; Mon, 10 Aug 2015 05:15:03 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:from:content-type:message-id:mime-version
         :subject:date:references:to:in-reply-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=4rfi0et5bwIzqcNOXmvlNbNzhyStnmvDHbwxYtJcy1Y=;
        b=PqPD7tMqSo/PnVCOAvvhrTrk78U0JWnJ6o1VTAh97CC3epPPL9Vn0jXn9KBRsIJnJ6
         6Z0K1er/lEGMnNz8aKKNeXPVtRyNk2f8BQ2ebIj0Puat+s3oo+FEZ3XXrrY1JoGma0Z1
         w2TLRBbucRDFj51O1J92962SOVdIKGohkiYnjCbJGHu6kekM1UAQhnifkf82jCkhq9yJ
         Ryp0WeWnxh3kSFDA2cGqIlJrs3nxBX7kjydMYUkpAJRH9QB+Uz0lCf11c1svmYnMJQGc
         wiA9gFhsl1HW4F+SXkQPUzgUOKOalWII1TdQBiOIvXPiiq2QgIGg7QACZ8oYKOVuCbyz
         xZDg==
X-Gm-Message-State: ALoCoQkm33FWROO5C76XKyySIuAtntfOTqD1vrasfEIryuaPW0BenBKcTG/jw35xAVDa7ek+O14H
X-Received: by 10.129.145.72 with SMTP id i69mr20685298ywg.57.1439208903155;
        Mon, 10 Aug 2015 05:15:03 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.13.69 with SMTP id 66ls1744765ion.68.gmail; Mon, 10 Aug
 2015 05:15:02 -0700 (PDT)
X-Received: by 10.68.229.195 with SMTP id ss3mr16156810pbc.100.1439208902335;
        Mon, 10 Aug 2015 05:15:02 -0700 (PDT)
Original-Received: from mail-pa0-x235.google.com (mail-pa0-x235.google.com. [2607:f8b0:400e:c03::235])
        by mx.google.com with ESMTPS id p15si15233041pdn.108.2015.08.10.05.15.02
        for <std-proposals@isocpp.org>
        (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Mon, 10 Aug 2015 05:15:02 -0700 (PDT)
Received-SPF: pass (google.com: domain of potswa@gmail.com designates 2607:f8b0:400e:c03::235 as permitted sender) client-ip=2607:f8b0:400e:c03::235;
Original-Received: by pabyb7 with SMTP id yb7so105677327pab.0
        for <std-proposals@isocpp.org>; Mon, 10 Aug 2015 05:15:02 -0700 (PDT)
X-Received: by 10.68.68.173 with SMTP id x13mr43834900pbt.143.1439208901466;
        Mon, 10 Aug 2015 05:15:01 -0700 (PDT)
Original-Received: from [172.20.10.2] ([121.54.44.91])
        by smtp.gmail.com with ESMTPSA id lk4sm19882693pab.23.2015.08.10.05.14.59
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Mon, 10 Aug 2015 05:15:00 -0700 (PDT)
In-Reply-To: <77b7c7d1-99f1-49be-925b-a43d7250fa71@isocpp.org>
X-Mailer: Apple Mail (2.2098)
X-Original-Sender: potswa@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of potswa@gmail.com designates 2607:f8b0:400e:c03::235 as permitted
 sender) smtp.mail=potswa@gmail.com;       dkim=pass header.i=@gmail.com;
       dmarc=pass (p=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-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://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>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:19746
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/19746>

--Apple-Mail=_8981BCA6-500E-4BD7-8FFB-0E595BDB5431
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8


> On 2015=E2=80=9308=E2=80=9310, at 7:27 PM, german.diago@hubblehome.com wr=
ote:
>=20
> "The community consensus seems to be that constexpr isn=E2=80=99t noise b=
ut a useful annotation."
>=20
> Well, I understand the severe limitations or that it may be technically u=
nfeasible, but as a function annotation, I do not see
> how it could be useful, since a function could most of the time be "poten=
tially constexpr".=20

As the Q&A shows, I tend to agree with you, against the majority. At least,=
 when writing a constexpr metaprogramming library or a computation of some =
nontrivial constant data structures, it=E2=80=99s noisy to mark every singl=
e declaration as constexpr. That was the motivation of my constexpr block s=
cope suggestion. Maybe, once the issue has come up for more people, a propo=
sal will find support.

I don=E2=80=99t think I=E2=80=99d advise anyone to just mark every function=
 as constexpr indiscriminately.

> In D they just say:
>=20
> enum auto val =3D myFunc();
>=20
> and get it done.

That=E2=80=99s not quite the same. C++ constexpr allows opportunistic evalu=
ation in non-constant expression contexts as well. It might cause trouble (=
slow compile times, reduced compiler stability) to have the compiler specul=
atively evaluating every expression, even functions of nontrivial complexit=
y that weren=E2=80=99t intended for compile time.

--=20

---=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--Apple-Mail=_8981BCA6-500E-4BD7-8FFB-0E595BDB5431
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;" class=3D""><br class=3D""><di=
v><blockquote type=3D"cite" class=3D""><div class=3D"">On 2015=E2=80=9308=
=E2=80=9310, at 7:27 PM, <a href=3D"mailto:german.diago@hubblehome.com" cla=
ss=3D"">german.diago@hubblehome.com</a> wrote:</div><br class=3D"Apple-inte=
rchange-newline"><div class=3D""><div dir=3D"ltr" class=3D"">"The community=
 consensus seems to be that constexpr isn=E2=80=99t noise but a useful anno=
tation."<br class=3D""><br class=3D"">Well, I understand the severe limitat=
ions or that it may be technically unfeasible, but as a function annotation=
, I do not see<br class=3D"">how it could be useful, since a function could=
 most of the time be "potentially constexpr". <br class=3D""></div></div></=
blockquote><div><br class=3D""></div><div>As the Q&amp;A shows, I tend to a=
gree with you, against the majority. At least, when writing a constexpr met=
aprogramming library or a computation of some nontrivial constant data stru=
ctures, it=E2=80=99s noisy to mark every single declaration as constexpr. T=
hat was the motivation of my constexpr block scope suggestion. Maybe, once =
the issue has come up for more people, a proposal will find support.</div><=
div><br class=3D""></div><div>I don=E2=80=99t think I=E2=80=99d advise anyo=
ne to just mark every function as <font face=3D"Courier" class=3D"">constex=
pr</font> indiscriminately.</div><br class=3D""><blockquote type=3D"cite" c=
lass=3D""><div class=3D""><div dir=3D"ltr" class=3D"">In D they just say:<b=
r class=3D""><br class=3D"">enum auto val =3D myFunc();<br class=3D""><br c=
lass=3D"">and get it done.<br class=3D""></div></div></blockquote><div><br =
class=3D""></div><div>That=E2=80=99s not quite the same. C++ constexpr allo=
ws opportunistic evaluation in non-constant expression contexts as well. It=
 might cause trouble (slow compile times, reduced compiler stability) to ha=
ve the compiler speculatively evaluating every expression, even functions o=
f nontrivial complexity that weren=E2=80=99t intended for compile time.</di=
v></div><br class=3D""></body></html>

<p></p>

-- <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+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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--Apple-Mail=_8981BCA6-500E-4BD7-8FFB-0E595BDB5431--

.
