[Issue 9821] Smarter conversion of strings to enums

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 26 18:20:06 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9821



--- Comment #5 from bearophile_hugs at eml.cc 2013-03-26 18:20:03 PDT ---
(In reply to comment #4)

> Sure, I understand if there's reluctance to change the meaning of to() in this
> case.

What I meant to say is that this semantics is bad:

> first tries to convert using enum member names, as it
> currently does, and *only if* that fails, then (2) tries to convert the string
> to the enum base type?

You try a conversion, and if it fails, then you _stop_. Otherwise you are going
into a swamp.


> But there should be at least some alternative function for converting strings
> to enums using the base type,

I think I have asked for such function in another Bugzilla issue.

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


More information about the Digitalmars-d-bugs mailing list