Making external types available to mixins

Neia Neutuladh neia at ikeran.org
Sat Nov 17 18:20:52 UTC 2018


On Sat, 17 Nov 2018 17:58:54 +0000, John Chapman wrote:
> The idea is that users could type (for example) makeWith!`Calendar`(…)
> instead of the longer makeWith!ICalendarFactory(…).

Your project might define a hundred types named ICalendarFactory; the 
compiler can't figure out which one you're talking about unless you use 
the fully qualified name.

If you require that Calendar and ICalendarFactory be defined in the same 
module, you can use Calendar's module name to look up the appropriate 
ICalendarFactory.

You can also just build a string that the calling code mixes in.


More information about the Digitalmars-d-learn mailing list