digitalmars.D.bugs - [Issue 11998] New: writeln with string enum outputs the enum name, not the string
- d-bugmail puremagic.com (33/33) Jan 25 2014 https://d.puremagic.com/issues/show_bug.cgi?id=11998
- d-bugmail puremagic.com (11/11) Jan 25 2014 https://d.puremagic.com/issues/show_bug.cgi?id=11998
- d-bugmail puremagic.com (15/15) Jan 27 2014 https://d.puremagic.com/issues/show_bug.cgi?id=11998
- d-bugmail puremagic.com (19/19) Jan 27 2014 https://d.puremagic.com/issues/show_bug.cgi?id=11998
- d-bugmail puremagic.com (10/10) Jan 27 2014 https://d.puremagic.com/issues/show_bug.cgi?id=11998
https://d.puremagic.com/issues/show_bug.cgi?id=11998 Summary: writeln with string enum outputs the enum name, not the string Product: D Version: unspecified Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: code dawg.eu cat > bug.d << CODE enum Enum : string { member = "printThis", } void main() { import std.stdio : writeln; writeln(member); } CODE dmd -run bug ---- Output is 'member' instead of 'printThis'. See http://dpaste.dzfl.pl/e801e755 ---- -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 25 2014
https://d.puremagic.com/issues/show_bug.cgi?id=11998 bearophile_hugs eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs eml.cc At best this is an enhancement request. But you are asking to add to make a special case for string enums. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 25 2014
https://d.puremagic.com/issues/show_bug.cgi?id=11998 Peter Alexander <peter.alexander.au gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |peter.alexander.au gmail.co | |m 12:41:31 PST --- I think this is by design. The EnumBaseType just indicates that the enum values can be implicitly converted to the EnumBaseType. It's not the same as `enum string member = "printThis";` I'm not a fan of special casing the output of string enums. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 27 2014
https://d.puremagic.com/issues/show_bug.cgi?id=11998 Maybe I was too fast with this, I just expected a different result. With anonymous enums it works btw. enum name1 = "printThis"; enum { name2 = "foo", name3 = "bar", } void main() { import std.stdio : writeln; writeln(name1, name2, name3); } http://dpaste.dzfl.pl/39b780cc -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 27 2014
https://d.puremagic.com/issues/show_bug.cgi?id=11998 Martin Nowak <code dawg.eu> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID Severity|normal |enhancement -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 27 2014