220 41138 <CAMSdZ4Zf+0meeQ4hzwZVZ_j88u5gpB_qd_XmsR-OfrhCyYndhw@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Bernardo Sulzbach <bernardo@bernardosulzbach.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Proposal: Extensions of Scoped Enumerations
Date: Thu, 29 Nov 2018 21:09:51 -0200
Lines: 71
Approved: news@gmane.org
Message-ID: <CAMSdZ4Zf+0meeQ4hzwZVZ_j88u5gpB_qd_XmsR-OfrhCyYndhw@mail.gmail.com>
References: <506ba0a8-2d6b-4a4d-8fe8-b5e94d232365@isocpp.org> <82c331a0-fb81-4b67-8a7e-c5a6b8929e00@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Trace: blaine.gmane.org 1543532883 6477 195.159.176.226 (29 Nov 2018 23:08:03 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 29 Nov 2018 23:08:03 +0000 (UTC)
Cc: philipgins@gmail.com
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCPLFUPA7QIRBTHDQHQAKGQERRNQGVY@isocpp.org Fri Nov 30 00:07:58 2018
Return-path: <std-proposals+bncBCPLFUPA7QIRBTHDQHQAKGQERRNQGVY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pf1-f197.google.com ([209.85.210.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCPLFUPA7QIRBTHDQHQAKGQERRNQGVY@isocpp.org>)
	id 1gSVPX-0001S7-3W
	for gclcip-std-proposals@m.gmane.org; Fri, 30 Nov 2018 00:07:55 +0100
Original-Received: by mail-pf1-f197.google.com with SMTP id t72sf2880241pfi.21
        for <gclcip-std-proposals@m.gmane.org>; Thu, 29 Nov 2018 15:10:05 -0800 (PST)
ARC-Seal: i=2; a=rsa-sha256; t=1543533005; cv=pass;
        d=google.com; s=arc-20160816;
        b=lUv7qZRSIQltEPLgBhCzf5PBG5ZU2Z8/9vgGfcIW44ECNdolYw93JwBO3CrkjyXYey
         615K2ps9x1tpvMMxQmRUFvu8qpeaktHpBv+IjTUmHT2kINhVkRm7D0lCUSfibNSqSpIi
         kHIzeqgmFRVNLAqfcD2sniRZ6xl3fS4tCDbmCgY2M4gDtRF9AdzF4VAkXSWlGIKLgq8i
         DoFlj598qU0gGZAHAxu0FxrNZqBLAO4ll6sfb/3+kWqiv2vpBzY9Q9EOScUl8dLKSxsM
         v1H4ru8ComCJ9SoXB5PsVNdsvwwWQkeGgx5DjtGjSTmFllp3wpPeSWCwkPSk1RU7VoLQ
         8MaA==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:content-transfer-encoding
         :cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:dkim-signature;
        bh=KuUtFYeNcJQaVUjrMRkqO5nis0xXrB3/kpa8q3LHNQE=;
        b=dbIfnHNxYkcjSxq+649mLAls9FH7g3TcrMgzT2QnVyLypuQJ7r984o4y0zFeWeT1R0
         omvXr+ydOhXoKjlmLw9Unvi/bbxXHzjg6s7y7cy4DYoV1G/VUbopBIeQdtDPDJH3sInY
         UMZ1KYrY81byfWLsut69OED2t0OL9IYo2/PMC/hrFh113NH2rdCjklKbzFmNL0vAoaAx
         DOq9iNAfl1s8s+1a3D23osay3LHwHB3ROYNOR026QNgQCVhuIeeXlJwEig81/avnf7PV
         E0YAKl3kQ2P92J5BXk7PdRznpyvRCkmK5eoDV/yiF2fCyjL4jTJ2OkcqefAgzYmeU4MO
         SiXg==
ARC-Authentication-Results: i=2; mx.google.com;
       spf=pass (google.com: domain of sulzbachbernardo@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=sulzbachbernardo@gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:references:in-reply-to:from:date:message-id:subject:to
         :cc:content-transfer-encoding:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=KuUtFYeNcJQaVUjrMRkqO5nis0xXrB3/kpa8q3LHNQE=;
        b=GxnKMfnMJE0rv2G4MoH2x1YnOq1bxwPUM3QONOQWF3MDVUTnOWICuma4o0Vjs8RcCi
         kMcWzb1pz7f53TZoGDU/8Z9vFyntrmeoGxqKrwGoZKHTiUOjAAexkerE5PEqJUQ/PdfJ
         +9NrWtat7mEGRYj2LltknwZ8J48yLXPWLdffD+mLgWhzE7gYBced1YTnhNt4BIMUr4gT
         pIh7kl4ITSFOZJ3Kc6NhTkJT9HDMPp4uK2DPb5fLJx5KU6wn/z3Z6efODFcR8Ku/pF84
         x+USSPmLc3XdlxrmmPC+wenqgnqQmTux9Wt3/Ii4VfkPHPtYUHPeDKn2wIZAK7oJpZgF
         BpIw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:references:in-reply-to:from:date
         :message-id:subject:to:cc:content-transfer-encoding
         :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=KuUtFYeNcJQaVUjrMRkqO5nis0xXrB3/kpa8q3LHNQE=;
        b=F7XbxftM/k/srI6AFQptj2C1J6S+g5d8SnOn0GUyMvAZ6Zqy7lD8qDiK9LQCHL6zxl
         98PBS54fm7kDASJUu4NXIgsEnP38Wq8dlpI5TwVTt0hwPdlV4oqalTMiyl0HFfVY5BHs
         2p+krJT/518OsnJjfJzZRmV4reaEEW1fYX5XJEGbgGnTsV/tAo63PQ+Ai46qZbnvRv3B
         kbEtR2KV9qRkSfZ9bVzU/yZzv6WXjB1lmETN8qc+jB6rcnbRhx64cujoCrQNlQ6j6hdT
         tf1QBTR4Rw3LzsLVZwEaelsN0Ze19i0lftAKcLrQar/+gBfl9QOxnpPQKWnq4sSQgsUu
          
X-Gm-Message-State: AA+aEWaTVttDr9ZVAFtttJJiwlFOzgo+6NUfBrcBt5DOsBZUd9hDJvuy
	o8rHE+CYmEYOTi+UIen2dg8=
X-Google-Smtp-Source: AFSGD/UIkqlLuprPTicJSHwapxxG/XtGGGLzMQzYio9vACUB0JLEKE47pXJamyUVHN6U/+Nv5gUyNA==
X-Received: by 2002:a63:6f81:: with SMTP id k123mr1658644pgc.5.1543533004991;
        Thu, 29 Nov 2018 15:10:04 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a17:902:ac86:: with SMTP id h6ls1772005plr.2.gmail; Thu, 29
 Nov 2018 15:10:03 -0800 (PST)
X-Received: by 2002:a17:902:8346:: with SMTP id z6mr3364372pln.340.1543533003972;
        Thu, 29 Nov 2018 15:10:03 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1543533003; cv=none;
        d=google.com; s=arc-20160816;
        b=k9UwkhPSOOkqVqrcoamY8aiYERdW9V2tPVROyFPnuc4xHmwmpYFpDN6ezyMUL7ZzFw
         RNEZZ5Nf1Wl/sOCR74iKrQe04Od6Vnb/DucneGBhhco7xhnL+5FUut2+A2ll4fjpJD5y
         BBrTj8+F9dZZAAcr+1bS0RIRXwajWZ3Ao+BFVj5FSWdOFvpGvVJos8bOSYbso+50pRQl
         jRshHjRl+ufz6YBhF6h1G6NFv87zKr2Gy8X0wz8gmDDsa1m7x5Ji1Op/iDNRmcTvYQRX
         QoDG7b93EZ5Yx+Ux+VsiYGFt/Hd4CdYXtcalet2pdnU1wKUMfFqOH1KAyvPLNg9CnLbU
         3qwg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-transfer-encoding:cc:to:subject:message-id:date:from
         :in-reply-to:references:mime-version;
        bh=k6AfA62DY9IVtXkxqEgG7CfL3XTkD30Sx2+T/wzZHoM=;
        b=QqZcnJiEXVafFDa9c5vUYTZoE4QMJ90SNRPhSj9UyfMMtsKNmquu8Wiu1G1EtBHJs+
         qSTw0PAqXJjQJnNC3fpO5edZZdbhxlBY2cVwcgg5mJgp2q9odKDDJ3VYM30d41iH9x+P
         TCUOFxxmjqbuIqY0ORFqXQ4AgH4nkA76y6h6SazSUaFzB1uxWV2FlnyOyKDB2tQsr+pi
         tQqsGDbZF5JiQt/2l2HyDZMEv1GhWtPY5hL98AKhHiXLZ71t4baKoGpVs4zIubAp+xnT
         seA+tBH76j7Rpab2whJ/2a3j/DaI56IWQKt4mqc89HJQE4Ki/RQgJ8TCtF8q/bMHK4Bg
         2cRA==
ARC-Authentication-Results: i=1; mx.google.com;
       spf=pass (google.com: domain of sulzbachbernardo@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=sulzbachbernardo@gmail.com
Original-Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41])
        by mx.google.com with SMTPS id f124sor4374020pgc.14.2018.11.29.15.10.03
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Thu, 29 Nov 2018 15:10:03 -0800 (PST)
Received-SPF: pass (google.com: domain of sulzbachbernardo@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 2002:a63:6150:: with SMTP id v77mr2838734pgb.266.1543533003471;
        Thu, 29 Nov 2018 15:10:03 -0800 (PST)
Original-Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com. [209.85.215.176])
        by smtp.gmail.com with ESMTPSA id l11sm4136536pff.65.2018.11.29.15.10.03
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Thu, 29 Nov 2018 15:10:03 -0800 (PST)
Original-Received: by mail-pg1-f176.google.com with SMTP id d72so1606321pga.9
        for <std-proposals@isocpp.org>; Thu, 29 Nov 2018 15:10:03 -0800 (PST)
X-Received: by 2002:a62:6303:: with SMTP id x3mr3420931pfb.110.1543533002751;
 Thu, 29 Nov 2018 15:10:02 -0800 (PST)
In-Reply-To: <82c331a0-fb81-4b67-8a7e-c5a6b8929e00@isocpp.org>
X-Gmail-Original-Message-ID: <CAMSdZ4Zf+0meeQ4hzwZVZ_j88u5gpB_qd_XmsR-OfrhCyYndhw@mail.gmail.com>
X-Original-Sender: sulzbachbernardo@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of sulzbachbernardo@gmail.com designates 209.85.220.41 as permitted
 sender) smtp.mailfrom=sulzbachbernardo@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:41138
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/41138>

I think this might be a very useful feature. For instance, when
transitioning from API A to API B (the next major version of A), B
signatures could use a subtype of the enumeration used in A during the
transition period. This would be better than adding unsupported values
to the A enumeration and better than simply repeating the already
existing constants in the new enumeration.
On Thu, Nov 29, 2018 at 8:34 PM Bengt Gustafsson
<bengt.gustafsson@beamways.com> wrote:
>
> I like your idea, but I am pretty sure it has been proposed and declined =
before. If my memory serves me there were perceived issues with duplicate e=
numerator values and possibly whether a sub-enum should be able to change t=
he value of a parent enumerator (in keeping with how a subclass can overrid=
e a name). I think you have to address this and I would suggest that you us=
e a "as if" strategy stating that the sub-enum is to be defined as if the a=
dded enumerators were textually appended to those of the base-enum.
>
> Maybe you should also specify if it is legal to not add any additional en=
umerators in the sub-enum, and if allowed, exactly what this means.
>
> Possibly the issue of multiple inheritance should be addressed to. Probab=
ly best to forbid this, but it could be of interest to merge sets of values=
, and it could possibly be legal if there are no common enumerator names or=
 values in both base-enums, except if both the enumerator and value are the=
 same (and any specified underlying type of course).
>
> Den torsdag 29 november 2018 kl. 19:24:47 UTC+1 skrev phili...@gmail.com:
>>
>> Hello,
>>
>> After receiving positive feedback on the sg14 mailing list, I'd now like=
 to share my proposal here.
>>
>> Abstract:
>> Scoped enumerations (=E2=80=9Cenum classes=E2=80=9D) provide a type safe=
 alternative to C-style enums.
>> It can be desirable to have enumerations that share a subset of their en=
umerators and
>> there is a natural correspondence between subtyping and adding enumerato=
rs to enums.
>> This proposal is for a simple, sound and practically useful extension to=
 the core language
>> standard to provide a mechanism for subtyping scoped enumerations.
>>
>> The complete proposal can be read here and an implementation is availabl=
e on github.
>> I'm looking forward to your feedback!
>>
>> Thanks,
>> Philip Ginsbach
>
> --
> 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/isoc=
pp.org/d/msgid/std-proposals/82c331a0-fb81-4b67-8a7e-c5a6b8929e00%40isocpp.=
org.

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/CAMSdZ4Zf%2B0meeQ4hzwZVZ_j88u5gpB_qd_XmsR-OfrhCy=
Yndhw%40mail.gmail.com.

.
