220 9888 <6F532E62-C10A-404A-8F0D-662B7EA3D202@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: Re: Explicitly-defaulted enumeration operators
Date: Tue, 18 Mar 2014 12:29:46 +0800
Lines: 104
Approved: news@gmane.org
Message-ID: <6F532E62-C10A-404A-8F0D-662B7EA3D202@gmail.com>
References: <3B09C97E-7ADE-49ED-8C31-B5B41CD3DDE7@gmail.com> <781009e3-cd3c-4cb8-b034-b51a7c97c750@isocpp.org> <E797CAFE-4967-4881-870D-569BF15C757E@gmail.com> <10450602-fee9-48c4-9fa2-d000e434f5fb@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\))
Content-Type: multipart/alternative; boundary="Apple-Mail=_59B47583-253A-4CC5-808C-AFB17D9AAFE7"
X-Trace: ger.gmane.org 1395116992 6765 80.91.229.3 (18 Mar 2014 04:29:52 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Tue, 18 Mar 2014 04:29:52 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCW25A7E3QCRBRMXT6MQKGQEDYXYATI@isocpp.org Tue Mar 18 05:30:01 2014
Return-path: <std-proposals+bncBCW25A7E3QCRBRMXT6MQKGQEDYXYATI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ie0-f199.google.com ([209.85.223.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCW25A7E3QCRBRMXT6MQKGQEDYXYATI@isocpp.org>)
	id 1WPlf5-0004hF-9K
	for gclcip-std-proposals@m.gmane.org; Tue, 18 Mar 2014 05:29:59 +0100
Original-Received: by mail-ie0-f199.google.com with SMTP id rl12sf24414717iec.6
        for <gclcip-std-proposals@m.gmane.org>; Mon, 17 Mar 2014 21:29:58 -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: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:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe:content-type;
        bh=66PW3LaN3Klw+pTChOhfG0Oe2TcE9RUAQGEjwfykUe0=;
        b=fSArmxTRYiCe3WYZsHIPwfsUOteUV5hdgU+C0QCPDO+B8IkGOpt1kmrT8OWhPYe7Fh
         ELaw9t41icDmd4Xve9BCWJuuvAqVpXK6/fRkGU6r/AS6U0Anlx6EdOA0S0RUBmZKuvB5
         skLFZtkFDnRkn/lgmF/R/0y5xfveoo9P9Of0n+6a5JdgyU314zldZnRSdocgN/NCv6E6
         9+yt+kFwStH4Dwuy2FhO5U1CE3FOPu6L4a3jYjsFz9PVg3i2PYmP5fYL8OTCoUIZA+pj
         /mwl9TFes2hUTaaxtxUc7mxM7FQUT7AMHdE3hOwHhwmK0zxYCzF6jyouLvyZT44UF3Zy
         aOIA==
X-Gm-Message-State: ALoCoQkOuU4pF8aMuolBNzgH19+JL/EwVPDQGzpUROLD3ne1iH0oTgsN4CvNWcAcpJTk74yCGAx6
X-Received: by 10.42.53.135 with SMTP id n7mr10130726icg.11.1395116998213;
        Mon, 17 Mar 2014 21:29:58 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.57.104 with SMTP id h8ls1321698igq.0.gmail; Mon, 17 Mar
 2014 21:29:57 -0700 (PDT)
X-Received: by 10.68.228.138 with SMTP id si10mr30199539pbc.13.1395116997220;
        Mon, 17 Mar 2014 21:29:57 -0700 (PDT)
Original-Received: from mail-pb0-x22c.google.com (mail-pb0-x22c.google.com [2607:f8b0:400e:c01::22c])
        by mx.google.com with ESMTPS id w4si828352paa.239.2014.03.17.21.29.57
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Mon, 17 Mar 2014 21:29:57 -0700 (PDT)
Received-SPF: pass (google.com: domain of potswa@gmail.com designates 2607:f8b0:400e:c01::22c as permitted sender) client-ip=2607:f8b0:400e:c01::22c;
Original-Received: by mail-pb0-f44.google.com with SMTP id rp16so6666149pbb.31
        for <std-proposals@isocpp.org>; Mon, 17 Mar 2014 21:29:57 -0700 (PDT)
X-Received: by 10.68.159.228 with SMTP id xf4mr30274610pbb.74.1395116997094;
        Mon, 17 Mar 2014 21:29:57 -0700 (PDT)
Original-Received: from [172.20.10.2] ([121.54.54.49])
        by mx.google.com with ESMTPSA id np9sm48252407pbc.31.2014.03.17.21.29.54
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Mon, 17 Mar 2014 21:29:56 -0700 (PDT)
In-Reply-To: <10450602-fee9-48c4-9fa2-d000e434f5fb@isocpp.org>
X-Mailer: Apple Mail (2.1874)
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:c01::22c 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-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:9888
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/9888>

--Apple-Mail=_59B47583-253A-4CC5-808C-AFB17D9AAFE7
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=ISO-8859-1


On 2014-03-18, at 12:19 PM, Matheus Izvekov <mizvekov@gmail.com> wrote:

>=20
> On Tuesday, March 18, 2014 1:06:31 AM UTC-3, David Krauss wrote:
>=20
> It proposes a feature that would supersede some uses of enumerations, but=
 even if it is adopted, the problem of correct usage of enumerations would =
still remain.
>=20
> A bitfield-like enumeration class wouldn't want to define addition and su=
btraction, except maybe as bitwise operations OR and ANDNOT. Not every enum=
eration with operators wants to be an opaque typedef.
>=20
> Actually, the feature as proposed there would allow you to default and de=
lete operator definitions, so you could have what you want, an int opaque a=
lias which has operator+ deleted, and so you can't do addition.

Oh, now I see. It's a bit of a radical approach.

The problem is that for "custom scalar" types we sometimes want intrinsical=
ly named values (enumerators) for things like bitsets, but other times we w=
ant floating-point underlying type, which is incompatible with named values=
 or often any specific values at all.

Perhaps now with opaque enum declarations, the use cases can be reconciled =
by allowing floating-point enumerations with the caveat that no enumerators=
 are allowed. Or perhaps the lack of implicit operators (and comparability =
to the underlying FP type) already provides sufficient safety and the langu=
age is ready for floating-point enumerations.

Anyway, my instinct is that building on the existing enumeration framework =
would be simpler than starting with typedefs. I should contact Walter, than=
ks again.

--=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=_59B47583-253A-4CC5-808C-AFB17D9AAFE7
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dwindows-1252"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-=
mode: space; -webkit-line-break: after-white-space;"><br><div><div>On 2014&=
ndash;03&ndash;18, at 12:19 PM, Matheus Izvekov &lt;<a href=3D"mailto:mizve=
kov@gmail.com">mizvekov@gmail.com</a>&gt; wrote:</div><br class=3D"Apple-in=
terchange-newline"><blockquote type=3D"cite"><div dir=3D"ltr"><br>On Tuesda=
y, March 18, 2014 1:06:31 AM UTC-3, David Krauss wrote:<blockquote class=3D=
"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc s=
olid;padding-left: 1ex;"><div style=3D"word-wrap:break-word"><br><div>It pr=
oposes a feature that would supersede some uses of enumerations, but even i=
f it is adopted, the problem of correct usage of enumerations would still r=
emain.</div><br><div>A bitfield-like enumeration class wouldn&rsquo;t want =
to define addition and subtraction, except maybe as bitwise operations OR a=
nd ANDNOT. Not every enumeration with operators wants to be an opaque typed=
ef.</div></div></blockquote><div><br>Actually, the feature as proposed ther=
e would allow you to default and delete operator definitions, so you could =
have what you want, an int opaque alias which has operator+ deleted, and so=
 you can't do addition.<br></div></div></blockquote><div><br></div><div>Oh,=
 now I see. It&rsquo;s a bit of a radical approach.</div><div><br></div><di=
v>The problem is that for &ldquo;custom scalar&rdquo; types we sometimes wa=
nt intrinsically named values (enumerators) for things like bitsets, but ot=
her times we want floating-point underlying type, which is incompatible wit=
h named values or often any specific values at all.</div><div><br></div><di=
v>Perhaps now with opaque enum declarations, the use cases can be reconcile=
d by allowing floating-point enumerations with the caveat that no enumerato=
rs are allowed. Or perhaps the lack of implicit operators (and comparabilit=
y to the underlying FP type) already provides sufficient safety and the lan=
guage is ready for floating-point enumerations.</div></div><br><div>Anyway,=
 my instinct is that building on the existing enumeration framework would b=
e simpler than starting with typedefs. I should contact Walter, thanks agai=
n.</div><div><br></div></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=_59B47583-253A-4CC5-808C-AFB17D9AAFE7--

.
