digitalmars.D - Type.stringof
- Michiel (6/6) Feb 21 2007 The documentation sais that all types should have the property
- Walter Bright (2/5) Feb 22 2007 In what case does it not work?
- Michiel (33/38) Feb 22 2007 Any case. I tried this:
- Lionello Lunesu (3/34) Feb 22 2007 That works just fine here, DMD 1.007
- Michiel (4/12) Feb 22 2007 Ah, I have DMD 1.003. Would that make the difference?
- Deewiant (4/15) Feb 22 2007 Seeing as .stringof was added in DMD 1.005, it might. ;-)
- Michiel (5/15) Feb 22 2007 Strange. It wasn't even so long ago that I downloaded the compiler. Has
- Lionello Lunesu (2/16) Feb 22 2007 17 days to be exact :)
-
BCS
(2/27)
Feb 22 2007
The bleeding edge doesn't last vary long around here.
- Max Samukha (12/25) Feb 22 2007 Yes, it has not been announced as part of the language. Walter said it
- Michiel (5/20) Feb 22 2007 Well, it's handy nonetheless. I'm using it in some assert(0) error messa...
- torhu (3/9) Feb 22 2007 I think that it would be good if the docs could mention with which
- Walter Bright (2/4) Feb 22 2007 It does in the changelog.
- Lionello Lunesu (5/10) Feb 22 2007 Not for .stringof it doesn't :)
- Leandro Lucarella (7/18) Feb 22 2007 And it's not very practical to read the doc and searching the changelog
- renoX (6/20) Feb 22 2007 Note that Kevin Bealer has made two versions of a template for
The documentation sais that all types should have the property .stringof, but it doesn't seem to work. Has it been renamed? Or doesn't it exist (anymore)? Thanks, -- Michiel
Feb 21 2007
Michiel wrote:The documentation sais that all types should have the property .stringof, but it doesn't seem to work. Has it been renamed? Or doesn't it exist (anymore)?In what case does it not work?
Feb 22 2007
Walter Bright wrote:Any case. I tried this: ------------------------------------------ module test; import std.stdio; struct Foo { } enum Enum { RED } typedef int myint; void main() { writefln((1+2).stringof); // "1 + 2" writefln(Foo.stringof); // "Foo" writefln(test.Foo.stringof); // "test.Foo" writefln(int.stringof); // "int" writefln((int*[5][]).stringof); // "int*[5][]" writefln(Enum.RED.stringof); // "Enum.RED" writefln(test.myint.stringof); // "test.myint" writefln((5).stringof); // "5" } ------------------------------------------ And got these errors: ------------------------------------------ main.d(13): Error: no property 'stringof' for type 'int' main.d(14): Error: no property 'stringof' for type 'Foo' main.d(15): Error: no property 'stringof' for type 'Foo' main.d(16): Error: no property 'stringof' for type 'int' main.d(17): Error: no property 'stringof' for type 'int*[5][]' main.d(18): Error: no property 'stringof' for type 'int' main.d(19): Error: no property 'stringof' for type 'int' main.d(20): Error: no property 'stringof' for type 'int' ------------------------------------------ -- MichielThe documentation sais that all types should have the property .stringof, but it doesn't seem to work. Has it been renamed? Or doesn't it exist (anymore)?In what case does it not work?
Feb 22 2007
Michiel wrote:Walter Bright wrote:That works just fine here, DMD 1.007 L.Any case. I tried this: ------------------------------------------ module test; import std.stdio; struct Foo { } enum Enum { RED } typedef int myint; void main() { writefln((1+2).stringof); // "1 + 2" writefln(Foo.stringof); // "Foo" writefln(test.Foo.stringof); // "test.Foo" writefln(int.stringof); // "int" writefln((int*[5][]).stringof); // "int*[5][]" writefln(Enum.RED.stringof); // "Enum.RED" writefln(test.myint.stringof); // "test.myint" writefln((5).stringof); // "5" }The documentation sais that all types should have the property .stringof, but it doesn't seem to work. Has it been renamed? Or doesn't it exist (anymore)?In what case does it not work?
Feb 22 2007
Lionello Lunesu wrote:Ah, I have DMD 1.003. Would that make the difference? -- MichielThat works just fine here, DMD 1.007Any case. I tried this:The documentation sais that all types should have the property .stringof, but it doesn't seem to work. Has it been renamed? Or doesn't it exist (anymore)?In what case does it not work?
Feb 22 2007
Michiel wrote:Lionello Lunesu wrote:Seeing as .stringof was added in DMD 1.005, it might. ;-) -- Remove ".doesnotlike.spam" from the mail address.Ah, I have DMD 1.003. Would that make the difference?That works just fine here, DMD 1.007Any case. I tried this:The documentation sais that all types should have the property .stringof, but it doesn't seem to work. Has it been renamed? Or doesn't it exist (anymore)?In what case does it not work?
Feb 22 2007
Deewiant wrote:Strange. It wasn't even so long ago that I downloaded the compiler. Has stringof only existed for a month or so? -- MichielSeeing as .stringof was added in DMD 1.005, it might. ;-)Ah, I have DMD 1.003. Would that make the difference?That works just fine here, DMD 1.007Any case. I tried this:The documentation sais that all types should have the property .stringof, but it doesn't seem to work. Has it been renamed? Or doesn't it exist (anymore)?In what case does it not work?
Feb 22 2007
Michiel wrote:Deewiant wrote:17 days to be exact :)Strange. It wasn't even so long ago that I downloaded the compiler. Has stringof only existed for a month or so?Seeing as .stringof was added in DMD 1.005, it might. ;-)Ah, I have DMD 1.003. Would that make the difference?That works just fine here, DMD 1.007Any case. I tried this:The documentation sais that all types should have the property .stringof, but it doesn't seem to work. Has it been renamed? Or doesn't it exist (anymore)?In what case does it not work?
Feb 22 2007
Lionello Lunesu wrote:Michiel wrote:The bleeding edge doesn't last vary long around here. <g>Deewiant wrote:17 days to be exact :)Strange. It wasn't even so long ago that I downloaded the compiler. Has stringof only existed for a month or so?Seeing as .stringof was added in DMD 1.005, it might. ;-)Ah, I have DMD 1.003. Would that make the difference?That works just fine here, DMD 1.007Any case. I tried this:The documentation sais that all types should have the property .stringof, but it doesn't seem to work. Has it been renamed? Or doesn't it exist (anymore)?In what case does it not work?
Feb 22 2007
On Thu, 22 Feb 2007 14:33:00 +0100, Michiel <nomail please.com> wrote:Deewiant wrote:Yes, it has not been announced as part of the language. Walter said it was because it didn't work correctly. And it really doesn't, at least for enums. For example, this gives int while Test is expected: enum Test : int { one } void main() { pragma (msg, Test.stringof); }Strange. It wasn't even so long ago that I downloaded the compiler. Has stringof only existed for a month or so?Seeing as .stringof was added in DMD 1.005, it might. ;-)Ah, I have DMD 1.003. Would that make the difference?That works just fine here, DMD 1.007Any case. I tried this:The documentation sais that all types should have the property .stringof, but it doesn't seem to work. Has it been renamed? Or doesn't it exist (anymore)?In what case does it not work?
Feb 22 2007
Max Samukha wrote:Well, it's handy nonetheless. I'm using it in some assert(0) error messages. Thanks for the help, everyone. I'll update the compiler. -- MichielYes, it has not been announced as part of the language. Walter said it was because it didn't work correctly. And it really doesn't, at least for enums. For example, this gives int while Test is expected:Strange. It wasn't even so long ago that I downloaded the compiler. Has stringof only existed for a month or so?Seeing as .stringof was added in DMD 1.005, it might. ;-)Ah, I have DMD 1.003. Would that make the difference?That works just fine here, DMD 1.007Any case. I tried this:The documentation sais that all types should have the property .stringof, but it doesn't seem to work. Has it been renamed? Or doesn't it exist (anymore)?In what case does it not work?
Feb 22 2007
Deewiant wrote:Michiel wrote:I think that it would be good if the docs could mention with which compiler version a feature was added.Ah, I have DMD 1.003. Would that make the difference?Seeing as .stringof was added in DMD 1.005, it might. ;-)
Feb 22 2007
torhu wrote:I think that it would be good if the docs could mention with which compiler version a feature was added.It does in the changelog.
Feb 22 2007
Walter Bright wrote:torhu wrote:Not for .stringof it doesn't :) By the way, it would be nice if .stringof for an enum member would return the actual enum stringized. Will this be possible? L.I think that it would be good if the docs could mention with which compiler version a feature was added.It does in the changelog.
Feb 22 2007
Lionello Lunesu escribió:Walter Bright wrote:And it's not very practical to read the doc and searching the changelog to see where that particular feature where added. -- Leandro Lucarella Integratech S.A. 4571-5252torhu wrote:Not for .stringof it doesn't :) By the way, it would be nice if .stringof for an enum member would return the actual enum stringized. Will this be possible?I think that it would be good if the docs could mention with which compiler version a feature was added.It does in the changelog.
Feb 22 2007
Lionello Lunesu a écrit :Walter Bright wrote:Note that Kevin Bealer has made two versions of a template for 'reflective enums'. I don't find the result totally satisfying as you loose the type safety in current version, but it's a good start. renoXtorhu wrote:Not for .stringof it doesn't :) By the way, it would be nice if .stringof for an enum member would return the actual enum stringized.I think that it would be good if the docs could mention with which compiler version a feature was added.It does in the changelog.Will this be possible? L.
Feb 22 2007