Thread overview | ||||||
---|---|---|---|---|---|---|
|
June 10, 2008 [Issue 2147] New: std.typecons broken (or wrong documentation presented) | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=2147 Summary: std.typecons broken (or wrong documentation presented) Product: D Version: 2.014 Platform: PC OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: bugzilla@digitalmars.com ReportedBy: arkangath@gmail.com The example given in the example for defineEnum in page http://www.digitalmars.com/d/2.0/phobos/std_typecons.html#defineEnum does not compile. The specific code is import std.stdio; import std.typecons; mixin(defineEnum!("Openmode", "READ", "WRITE", "READWRITE", "APPEND")); void main() { Openmode m = Openmode.READ; string s = toString(m); assert(s == "READ"); Openmode m1; assert(fromString(s, m1) && m1 == m); } But DMD (the latest 2.x version) claims that .toString does not exist. Was it removed or broken? Should the bug be filed has "inconsistent documentation" or "broken library"? Lastly, why not put the .toString directly onto the enum structure? Going around with this mixin is just ugly. -- |
June 10, 2008 Re: [Issue 2147] New: std.typecons broken (or wrong documentation presented) | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | <d-bugmail@puremagic.com> wrote in message news:bug-2147-3@http.d.puremagic.com/issues/... > http://d.puremagic.com/issues/show_bug.cgi?id=2147 > > Summary: std.typecons broken (or wrong documentation presented) > Product: D > Version: 2.014 > Platform: PC > OS/Version: All > Status: NEW > Severity: normal > Priority: P2 > Component: Phobos > AssignedTo: bugzilla@digitalmars.com > ReportedBy: arkangath@gmail.com > > > The example given in the example for defineEnum in page > http://www.digitalmars.com/d/2.0/phobos/std_typecons.html#defineEnum > does not compile. > The specific code is > > import std.stdio; > import std.typecons; > mixin(defineEnum!("Openmode", "READ", "WRITE", "READWRITE", "APPEND")); > void main() > { > Openmode m = Openmode.READ; > string s = toString(m); > assert(s == "READ"); > Openmode m1; > assert(fromString(s, m1) && m1 == m); > } > > But DMD (the latest 2.x version) claims that .toString does not exist. Was > it > removed or broken? Should the bug be filed has "inconsistent > documentation" or > "broken library"? > > Lastly, why not put the .toString directly onto the enum structure? Going around with this mixin is just ugly. The functions seem to have changed to "enumToString" and "enumFromString". The docs have not been updated. |
October 11, 2009 [Issue 2147] std.typecons broken (or wrong documentation presented) | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2147 Andrei Alexandrescu <andrei@metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |andrei@metalanguage.com AssignedTo|nobody@puremagic.com |andrei@metalanguage.com -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 26, 2010 [Issue 2147] std.typecons broken (or wrong documentation presented) | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2147 Andrei Alexandrescu <andrei@metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |WONTFIX --- Comment #1 from Andrei Alexandrescu <andrei@metalanguage.com> 2010-09-26 08:30:43 PDT --- Regular enums now support conversion to and from string, which makes defineEnum unnecessary. I deprecated it. http://www.dsource.org/projects/phobos/changeset/2051 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation