220 5121 <CAOfiQqmuf=DSAa2nTn_HkNTYf0vOToTEbRnADqqh2tBONQUQ+A@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Richard Smith <richard@metafoo.co.uk>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: constexpr data member
Date: Wed, 19 Jun 2013 12:18:15 -0700
Lines: 48
Approved: news@gmane.org
Message-ID: <CAOfiQqmuf=DSAa2nTn_HkNTYf0vOToTEbRnADqqh2tBONQUQ+A@mail.gmail.com>
References: <CAGsORuDonz16fG51JaLgDCHptjpZAnuWM2AgNrBN_44hxUqjXA@mail.gmail.com>
	<300a19dd-8a82-4788-9802-45170480b30a@isocpp.org>
	<CAGsORuBWr7F6wpyUd1mBFDKGU7P9jKaPaq+wOYDpFL6QGH7Byw@mail.gmail.com>
	<63d90b03-5605-476d-b40b-7ebcee0d3354@isocpp.org>
	<CAGsORuD58nw+76_2_pp6GqpwGKhbVHJ40wnCZccrUXRjxB_qNQ@mail.gmail.com>
	<cf218cdb-bfda-46e7-bedb-23795ace1ae3@isocpp.org>
	<CAGsORuAMLbeFJZwrjmaMV6AF7rop==h8BJiGiBAtgxQxO7E++g@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: ger.gmane.org 1371669497 29303 80.91.229.3 (19 Jun 2013 19:18:17 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 19 Jun 2013 19:18:17 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDVNBJG4YAIBB54HRCHAKGQEFVM4RRI@isocpp.org Wed Jun 19 21:18:17 2013
Return-path: <std-proposals+bncBDVNBJG4YAIBB54HRCHAKGQEFVM4RRI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-gh0-f199.google.com ([209.85.160.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDVNBJG4YAIBB54HRCHAKGQEFVM4RRI@isocpp.org>)
	id 1UpNtZ-0000FZ-4p
	for gclcip-std-proposals@m.gmane.org; Wed, 19 Jun 2013 21:18:17 +0200
Original-Received: by mail-gh0-f199.google.com with SMTP id g14sf4618745ghb.10
        for <gclcip-std-proposals@m.gmane.org>; Wed, 19 Jun 2013 12:18:16 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=x-beenthere:mime-version:sender:in-reply-to:references:date
         :message-id:subject:from:to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-google-group-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe:content-type;
        bh=y41ncTwjQEjjVEeReqOUhm6ibBqzXNSQqEJq+lMQrX8=;
        b=n1wSsM56006dsRl9LP1+6zlsVeboOFVs444jcmJHzOKSS1aE5C0ftPiQHobkJAbuxd
         1bUR7LSyRCEztM3h10M7RSEURd5g6OuOLFeAt/2h01U41A99NniH8xSXZmHbbbYP3sl4
         M+DldXDcOndscEtFS/A3zN7C4m7q6EbEFc33AdWLetUMHpkmvSBgSSIyOOVTJ52fIvsv
         cYl6aQD3rMD4doR+Y2cTrUMDKl7derDPrtkQt7btPegLnPTdVHdKmLw0ZLSwgVbdrAZE
         Q8Rk3rSY5JNz7ZS0cWVPmkilY317pT/HiEjiApNevg+xDkpsuivpl3vTVjT8REva1GkN
         mcyw==
X-Received: by 10.236.15.73 with SMTP id e49mr2314485yhe.15.1371669496307;
        Wed, 19 Jun 2013 12:18:16 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.49.88.99 with SMTP id bf3ls385306qeb.78.gmail; Wed, 19 Jun
 2013 12:18:15 -0700 (PDT)
X-Received: by 10.58.249.236 with SMTP id yx12mr1435163vec.25.1371669495701;
        Wed, 19 Jun 2013 12:18:15 -0700 (PDT)
Original-Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182])
        by mx.google.com with ESMTPS id tq4si6897383vdc.27.2013.06.19.12.18.15
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Wed, 19 Jun 2013 12:18:15 -0700 (PDT)
Received-SPF: pass (google.com: domain of metafoo@gmail.com designates 209.85.220.182 as permitted sender) client-ip=209.85.220.182;
Original-Received: by mail-vc0-f182.google.com with SMTP id id13so4145531vcb.13
        for <std-proposals@isocpp.org>; Wed, 19 Jun 2013 12:18:15 -0700 (PDT)
X-Received: by 10.52.69.177 with SMTP id f17mr1221509vdu.48.1371669495311;
 Wed, 19 Jun 2013 12:18:15 -0700 (PDT)
Original-Sender: metafoo@gmail.com
Original-Received: by 10.58.206.110 with HTTP; Wed, 19 Jun 2013 12:18:15 -0700 (PDT)
In-Reply-To: <CAGsORuAMLbeFJZwrjmaMV6AF7rop==h8BJiGiBAtgxQxO7E++g@mail.gmail.com>
X-Original-Sender: richard@metafoo.co.uk
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of metafoo@gmail.com designates 209.85.220.182 as permitted sender)
 smtp.mail=metafoo@gmail.com;       dkim=pass header.i=@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: <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: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:5121
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/5121>

On Wed, Jun 19, 2013 at 11:43 AM, Zhihao Yuan <lichray@gmail.com> wrote:
> On Wed, Jun 19, 2013 at 1:06 PM, Jonathan Wakely <cxx@kayari.org> wrote:
>> Does it enable new features not currently available?  No it would just save
>> some typing.
>
> I mentioned we can allow it in local class.  But yea, the major
> physical difference is all about saving typing.

C++ has a history of making one keyword imply another in various
contexts. In my experience, it makes the language more complex, and
harder to read and reason about. (For an example of that, try to
summarize the rules on when a variable has external linkage.)

>> Your proposal to change the meaning of constexpr on
>> a member variable does not imply anything about linkage, but makes the
>> member static. That's inconsistent with *everything* else.
>
> I prefer not to be limited by the specific behaviors, but think
> it like a designer.  The design purpose of `constexpr` is to
> define *real* constant, which has no storage.

constexpr is not limited to that purpose. It is also used to require
static initialization for a constant variable, for instance, and it
certainly doesn't prohibit taking the address of the variable, or
binding a reference to it, or calling a member function on it, all of
which require storage.

>> Does it make the langue easier to teach?
>
> Yes!  So that we can teach "constexpr variables are just constant,
> don't spent your time on figuring out *what* exactly they are".

If you need to say "don't try to understand this", that does not
suggest it is easy to teach. Right now, we have a simple rule that
class members are instance-specific if they are not 'static', and are
not instance-specific if they are 'static'. Adding a 'constexpr'
special case seems to make that rule more complex.

-- 

--- 
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.



.
