220 28083 <791a04ce-3dd7-fc31-8798-ee4fe812d7fb@wanadoo.fr> article
Path: news.gmane.org!.POSTED!not-for-mail
From: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Make (strongly typed) enums castable to char
 const * const
Date: Wed, 31 Aug 2016 22:34:40 +0200
Lines: 42
Approved: news@gmane.org
Message-ID: <791a04ce-3dd7-fc31-8798-ee4fe812d7fb@wanadoo.fr>
References: <878tvfl89r.fsf@gmail.com>
 <CAKiZDp3O2piEZy7Dr4XSPQqO+Zd-rv06aiQVnaCJ=F8d0A83sw@mail.gmail.com>
 <CAPVNwa9R8EQm_py0x4=sneEog39Ksgxp+oVNiqerxLTO2qxH8w@mail.gmail.com>
 <e8e400ef-d60f-448c-9594-15c75e9728e9@isocpp.org>
 <CAKiZDp2+5Mh2y-uzp9Oc6gqvtam4-QNocLGipQNHLp9y1A-ODQ@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Trace: blaine.gmane.org 1472675704 29757 195.159.176.226 (31 Aug 2016 20:35:04 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 31 Aug 2016 20:35:04 +0000 (UTC)
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0)
 Gecko/20100101 Thunderbird/45.2.0
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDH67CONY4PBBX76TS7AKGQENURBM5I@isocpp.org Wed Aug 31 22:35:00 2016
Return-path: <std-proposals+bncBDH67CONY4PBBX76TS7AKGQENURBM5I@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wm0-f71.google.com ([74.125.82.71])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDH67CONY4PBBX76TS7AKGQENURBM5I@isocpp.org>)
	id 1bfCDm-0006C9-Mr
	for gclcip-std-proposals@m.gmane.org; Wed, 31 Aug 2016 22:34:54 +0200
Original-Received: by mail-wm0-f71.google.com with SMTP id m139sf22290366wma.0
        for <gclcip-std-proposals@m.gmane.org>; Wed, 31 Aug 2016 13:34:56 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=subject:to:references:from:message-id:date:user-agent:mime-version
         :in-reply-to: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=QI/29aOC26OKLxq/FAdZIrxb9wrqHR4Y+oS/FH/FTkE=;
        b=TXsROKUDDPIibBp43tKy47p6ViaeiPWnTN3/TVuywKcFhNZAYDux5jXqRfvJ5yqdHN
         CdhOGE0tofosL8mGIKw8pnwAlRCwmV+5jXZd9QDtapenn5XBPIm166M77IpxUtYKDdib
         KYFXLh4MYpl7bQ8bnZ+bycWyAdZGqaVxQkTtkGMctPMHtY88s/WBJrkqa/Y0oumQxyIY
         +fOLYyV/oMgH1IQaaTDWJ24iQjEt4uxZnrLFS1PoUh22/EfwYhfnatv7FgnRx4BsRath
         nIHREG48L0KJVi4C8zVevikuYNxPfvoGOqQLzDR+Gv/ncd8J2OcOJ+dHRAWhcf/cFdmH
      
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:subject:to:references:from:message-id:date
         :user-agent:mime-version:in-reply-to: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=QI/29aOC26OKLxq/FAdZIrxb9wrqHR4Y+oS/FH/FTkE=;
        b=H5UEQjlPQnbtlL6YI5smae2rMdQtWEIiCo4njuNLcUz6h6OYIcH3vd/GOf3MxROXUk
         nXIMxYNbvBkqZ6ueU/gWZjoJ67YGeezwEQHH/LOpm4x5zSRXC+WQamgf21RfoNbEiYnM
         7EnQt8jCZGNinmIdIn3NpCmrMrsD8g6xDsfIuF+yHHZ2MHR+/oA/I2SAXO9+uFabkEWm
         aB+ifD6Xr4s7GRCeA/7+PBbMGpxDrOYAK25lQPoTSbhFAEix9LhWIBuF1FRhPATkUGRh
         eIe+AADw6OKZ7oQ743xlIWdsmd0SbSm6ywuIpFa4FdiOI/J73sA04WAYT+U3WQxEmzxh
  
X-Gm-Message-State: AE9vXwMWQUtHTC9AiQmeehENauac1kQjiw0CdHu/SZtLrK03ll+lSuBkfx/3NO8QEAP2Yw==
X-Received: by 10.194.119.105 with SMTP id kt9mr1786386wjb.1.1472675690756;
        Wed, 31 Aug 2016 13:34:50 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.28.164.132 with SMTP id n126ls1513010wme.1.gmail; Wed, 31 Aug
 2016 13:34:37 -0700 (PDT)
X-Received: by 10.28.98.135 with SMTP id w129mr11634561wmb.38.1472675676479;
        Wed, 31 Aug 2016 13:34:36 -0700 (PDT)
Original-Received: from smtp.smtpout.orange.fr (smtp10.smtpout.orange.fr. [80.12.242.132])
        by mx.google.com with ESMTPS id si1si1803243wjb.210.2016.08.31.13.34.36
        for <std-proposals@isocpp.org>
        (version=TLS1 cipher=AES128-SHA bits=128/128);
        Wed, 31 Aug 2016 13:34:36 -0700 (PDT)
Received-SPF: neutral (google.com: 80.12.242.132 is neither permitted nor denied by best guess record for domain of vicente.botet@wanadoo.fr) client-ip=80.12.242.132;
Original-Received: from pc38.home ([2.13.33.56])
	by mwinf5d33 with ME
	id dwaa1t00B1CfgbE03wabX0; Wed, 31 Aug 2016 22:34:36 +0200
X-ME-Helo: pc38.home
X-ME-Auth: dmljZW50ZS5ib3RldEB3YW5hZG9vLmZy
X-ME-Date: Wed, 31 Aug 2016 22:34:36 +0200
X-ME-IP: 2.13.33.56
In-Reply-To: <CAKiZDp2+5Mh2y-uzp9Oc6gqvtam4-QNocLGipQNHLp9y1A-ODQ@mail.gmail.com>
X-Original-Sender: vicente.botet@wanadoo.fr
X-Original-Authentication-Results: mx.google.com;       spf=neutral
 (google.com: 80.12.242.132 is neither permitted nor denied by best guess
 record for domain of vicente.botet@wanadoo.fr) smtp.mailfrom=vicente.botet@wanadoo.fr
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: <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:28083
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/28083>

Le 31/08/2016 =C3=A0 02:59, Patrice Roy a =C3=A9crit :
> An important issue I was trying to bring up (but failed :) ) is the=20
> handling of values from the underlying type that don't match effective=20
> enum values. C# does something, it might not be what we want, and what=20
> one of us wants does not necessarily match what another one of us wants.
>
> I think Edward saw this : the difficulty in making standard=20
> enum-to-string behavior is (a) what to do with values that don't map=20
> to an enum constant, and (b) choosing what to do with scope names=20
> (class, namespace, ...) with the relevant string values. These issues=20
> don't seem easy to settle in a standard fashion, at least in my eyes,=20
> as there are valid arguments for various behaviors.
You are right that there are some variation points.

(a) I believe the C# option is a good one. If the user wants to check=20
for validity of an enum constant another function can be provided and=20
the user could combine them. This is a subset of enums.

(b) I believe that having the string for the enumerators is the minimal=20
feature and it is already beter than the number. We can as well have=20
another function that allows to obtain the string associated to the scope.

>
> Now, if someone could write a proposal that both offers language=20
> support for some behavior, and backs it up with library functions that=20
> let users control the conversion behavior efficiently, then... :)

I hope that someone would propose something once we have reflection=20
delivered by a major compiler ;-)

Vicente

--=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/791a04ce-3dd7-fc31-8798-ee4fe812d7fb%40wanadoo.f=
r.

.
