Top 5

Christian Kamm kamm-incasoftware at removethis.de
Sun Oct 12 00:08:07 PDT 2008


> I wrote Appender with future extensibility in mind: any collection of
> the future (list, deque...) can specialize Appender to append to them.
> Then client code can transparently use Appender!C to append to any
> collection C. Yum, I even used the new syntax :o).

Hm, so are there plans to make template specializations in different modules
work together seamlessly?

At the moment:
a.d: 
struct Appender(A : T[], T) {}

b.d: 
struct MyArr(T) {}
struct Appender(A : MyArr!(T), T) {}

use.d:
import a;
import b;
void main() {
  Appender!(int[]) ainst;
  Appender!(MyArr!(int)) binst;
}

yields (DMD 2.018)
use.d(6): template instance Appender is not a template declaration, it is a
overloadset
use.d(6): Error: Appender!(int[]) is used as a type
use.d(6): variable use.main.a voids have no value




More information about the Digitalmars-d mailing list