Type unions in D

Justin Johansson procode at adam-dott-com.au
Tue Sep 15 16:41:40 PDT 2009


Correction:

> Suppose there is some class X, I'd like to have a first class type for representing the following quantified types (using RegExp notation):
> X?  zero or one instances of an X  (call this type XQ)
> X a single instance of X
> X* zero or more instances of X  (call this type XS)
> X+ at least one X (call this type XP)

> To unify the whole thing, now let X, XQ, XS and XP all be derived from a common base type T.

Should be:
> X?  zero or one instances of T  (call this type XQ)
> X a single instance of T
> X* zero or more instances of T  (call this type XS)
> X+ at least one T (call this type XP)

JJ




More information about the Digitalmars-d mailing list