typeof.stringof wrong type

2016-08-17 Thread Eugene Wissner via Digitalmars-d-learn
I have a problem, that .stringof doesn't return what I'm expecting. Consider the following: template A(string T) { enum A : bool { yes = true, } } void main() { A!"asdf" a1; typeof(a1) a2; mixin(typeof(a1).stringof ~ " a3;"); } I

Re: typeof.stringof wrong type

2016-08-17 Thread ag0aep6g via Digitalmars-d-learn
On 08/17/2016 02:08 PM, Eugene Wissner wrote: I have a problem, that .stringof doesn't return what I'm expecting. Consider the following: template A(string T) { enum A : bool { yes = true, } } void main() { A!"asdf" a1; typeof(a1) a2; mixin(typeof(a1).stringof ~

Re: typeof.stringof wrong type

2016-08-17 Thread Eugene Wissner via Digitalmars-d-learn
On Wednesday, 17 August 2016 at 12:39:18 UTC, ag0aep6g wrote: On 08/17/2016 02:08 PM, Eugene Wissner wrote: I have a problem, that .stringof doesn't return what I'm expecting. Consider the following: template A(string T) { enum A : bool { yes = true, } } void main() {

Re: typeof.stringof wrong type

2016-08-19 Thread Eugene Wissner via Digitalmars-d-learn
fullyQualifiedName doesn't work with BitFlags for example: import std.stdio; import std.typecons; import std.traits; enum Stuff { asdf } void main() { BitFlags!Stuff a; typeof(a) b; mixin(fullyQualifiedName!(typeof(a)) ~ " c;"); mixin(typeof(a).stringof

Re: typeof.stringof wrong type

2016-08-19 Thread ag0aep6g via Digitalmars-d-learn
On 08/19/2016 02:42 PM, Eugene Wissner wrote: fullyQualifiedName doesn't work with BitFlags for example: I think that qualifies as a bug, because fullyQualifiedName is supposed to be usable in code generation.

Re: typeof.stringof wrong type

2016-08-19 Thread David Nadlinger via Digitalmars-d-learn
On Friday, 19 August 2016 at 15:15:55 UTC, ag0aep6g wrote: I think that qualifies as a bug, because fullyQualifiedName is supposed to be usable in code generation. This is a misconception. Neither .stringof nor fullyQualifiedName should *ever* be used in code generation. There is a myriad of

Re: typeof.stringof wrong type

2016-08-19 Thread ag0aep6g via Digitalmars-d-learn
On 08/19/2016 05:36 PM, David Nadlinger wrote: This is a misconception. Neither .stringof nor fullyQualifiedName should *ever* be used in code generation. The spec itself recommends fullyQualifiedName for code generation: Note: Using .stringof for code generation is not recommended, as the in

Re: typeof.stringof wrong type

2016-08-19 Thread David Nadlinger via Digitalmars-d-learn
On Friday, 19 August 2016 at 15:47:00 UTC, ag0aep6g wrote: https://dlang.org/spec/property.html#stringof Someone should edit that, if fullyQualifiedName is no good either. Indeed. I'm sure the change was well-intentioned, but symbol visibility/import concerns and Voldemort types should make

Re: typeof.stringof wrong type

2016-08-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, August 19, 2016 15:36:02 David Nadlinger via Digitalmars-d-learn wrote: > On Friday, 19 August 2016 at 15:15:55 UTC, ag0aep6g wrote: > > I think that qualifies as a bug, because fullyQualifiedName is > > supposed to be usable in code generation. > > This is a misconception. Neither .str

Re: typeof.stringof wrong type

2016-08-19 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 19 August 2016 at 18:52:02 UTC, Jonathan M Davis wrote: Unfortunately, once you start doing stuff with things like __traits(allMembers, ...), you're dealing with strings You should immediately go back into symbol land by passing that string into __traits(getMember). I agree that s