www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2087] New: Merge stc.typecons.defineEnum with enum

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2087

           Summary: Merge stc.typecons.defineEnum with enum
           Product: D
           Version: 2.014
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: spec
          Severity: enhancement
          Priority: P5
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: arkangath gmail.com


I find that nearly (if not) every enum in my code is defined using
std.typecons.defineEnum for the toString() and fromString() functionality.
I'd suggest moving this into the language itself. Like Objects, an enum will
have a .toString property which does exactly what is defined on the  defineEnum
mixin.
The fromString() isn't as important, but since we're at it, why not do the full
round?
Defining enums with this mixin wrecks chaos on IDE parsers, as I try to use
"MsgType" as a variable type and the IDE's parser never knows of it.


-- 
May 09 2008
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2087


kennytm gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |kennytm gmail.com
         Resolution|                            |FIXED


--- Comment #1 from kennytm gmail.com 2011-06-10 12:25:21 PDT ---
enum is not a class, there will not be enum.toString. Nevertheless, std.conv.to
supports converting between an enum and string for a number of versions
already. std.typecons.defineEnum has also been deprecated.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 10 2011