type inference by module

Erik Smith via Digitalmars-d digitalmars-d at puremagic.com
Sat Feb 27 11:04:36 PST 2016


I'm having a tough time finding a workaround for not being able 
to reference adjacent types in a module 
(https://issues.dlang.org/show_bug.cgi?id=15726).   This is how I 
want to do it, but can't:

module x.y.z;

struct A(T) {
   alias B = .B!T;
}

struct B(T) {
   alias A = .B!T;
   alias C = .C!T;
}

struct C(T) {
   alias B = .B!T;
}

Higher layer code needs to be able to infer related types given a 
single type.   I also looked at creating a external template 
specialization, but it doesn't help because the type names are 
repeated across modules.   I thought there might be some way to 
do this (with mythical # operator):

A#B   // Refer to type B that is in same module as A

Any ideas on alternative ways to accomplish this?

erik



More information about the Digitalmars-d mailing list