Type.stringof is removing alias and bitmanip

John Colvin via Digitalmars-d digitalmars-d at puremagic.com
Mon Dec 8 07:23:41 PST 2014


On Monday, 8 December 2014 at 08:25:36 UTC, deadalnix wrote:
> As a result, it is impossible to use thing like bitfields in 
> templates.
>
> I'm trying to do something like
>
> struct MySuperStruct(E) {
> 	enum DataSize = ulong.sizeof * 8 - EnumSize!E;
> 	
> 	import std.bitmanip;
> 	mixin(bitfields!(
> 		E, "kind", EnumSize!E,
> 		ulong, "data", DataSize,
> 	));
> 	
>         // More stuuuuuuufffffff \o/
> }
>
> But obviously, that won't work as mixins are using the real 
> type of E, and not E. I ran into that problem on other forms, 
> and always was able to work around it, but on that one, there 
> is no way around it.

We need a way to actually rename types.

Personally I would like a resurrection of typedef to *only* 
opaquely rename types and to be identical to alias in all other 
ways.
Everything else important can be dealt with by one or more 
library types, renaming is the missing piece.


More information about the Digitalmars-d mailing list