Re: qualified type names for mixins

2017-06-16 Thread Jonathan Marler via Digitalmars-d
On Friday, 16 June 2017 at 03:57:17 UTC, Adam D. Ruppe wrote: On Friday, 16 June 2017 at 03:26:28 UTC, Jonathan Marler wrote: [...] The real WTF is that it returns a string in the first place. It should return a struct. [...] PR Here: https://github.com/dlang/phobos/pull/5490 Currently n

Re: qualified type names for mixins

2017-06-15 Thread Jonathan Marler via Digitalmars-d
On Friday, 16 June 2017 at 03:57:17 UTC, Adam D. Ruppe wrote: On Friday, 16 June 2017 at 03:26:28 UTC, Jonathan Marler wrote: If you have a better idea on how to implement the bitfields template that would be great. The real WTF is that it returns a string in the first place. It should return

Re: qualified type names for mixins

2017-06-15 Thread Adam D. Ruppe via Digitalmars-d
On Friday, 16 June 2017 at 03:26:28 UTC, Jonathan Marler wrote: If you have a better idea on how to implement the bitfields template that would be great. The real WTF is that it returns a string in the first place. It should return a struct. Here, take a look at this: - /++

Re: qualified type names for mixins

2017-06-15 Thread Jonathan Marler via Digitalmars-d
On Thursday, 15 June 2017 at 22:59:23 UTC, Adam D. Ruppe wrote: On Thursday, 15 June 2017 at 22:36:56 UTC, Jonathan Marler wrote: Doesn't work with eponymous templates, like std.traits.Flag. For example, make this code work: That uses `.stringof` which means it is useless for anything except

Re: qualified type names for mixins

2017-06-15 Thread Adam D. Ruppe via Digitalmars-d
On Thursday, 15 June 2017 at 22:36:56 UTC, Jonathan Marler wrote: Doesn't work with eponymous templates, like std.traits.Flag. For example, make this code work: That uses `.stringof` which means it is useless for anything except informational printing. Post the code you are actually doing (

Re: qualified type names for mixins

2017-06-15 Thread Jonathan Marler via Digitalmars-d
On Thursday, 15 June 2017 at 21:54:44 UTC, Adam D. Ruppe wrote: On Thursday, 15 June 2017 at 21:26:38 UTC, Jonathan Marler wrote: The common use case is when you'd like to mixin a type when it is passed to a template. That's also the most common wrong case. If it is passed to a template, you

Re: qualified type names for mixins

2017-06-15 Thread Adam D. Ruppe via Digitalmars-d
On Thursday, 15 June 2017 at 21:26:38 UTC, Jonathan Marler wrote: The common use case is when you'd like to mixin a type when it is passed to a template. That's also the most common wrong case. If it is passed to a template, you have a local name that you should use because it will work despi

Re: qualified type names for mixins

2017-06-15 Thread Jonathan Marler via Digitalmars-d
On Thursday, 15 June 2017 at 20:34:39 UTC, Adam D. Ruppe wrote: On Thursday, 15 June 2017 at 19:15:55 UTC, Jonathan Marler wrote: I've found that the fullyQualifiedName template in std.traits is a good tool for creating mixin code, however, it doesn't always work. Why is it useful? I suggest

Re: qualified type names for mixins

2017-06-15 Thread Adam D. Ruppe via Digitalmars-d
On Thursday, 15 June 2017 at 19:15:55 UTC, Jonathan Marler wrote: I've found that the fullyQualifiedName template in std.traits is a good tool for creating mixin code, however, it doesn't always work. Why is it useful? I suggest you are probably doing it wrong. https://stackoverflow.com/quest

qualified type names for mixins

2017-06-15 Thread Jonathan Marler via Digitalmars-d
I've found that the fullyQualifiedName template in std.traits is a good tool for creating mixin code, however, it doesn't always work. - import std.traits; struct GlobalFoo { int x; } // WORKS mixin(fullyQualifiedName!GlobalFoo ~ " globalFoo;"); unittest { static struct Foo {