Template mixin problem

Olli Aalto oaalto at gmail.com
Mon Dec 15 00:58:31 PST 2008


Bill Baxter wrote:
> On Mon, Dec 15, 2008 at 5:48 PM, Olli Aalto <oaalto at gmail.com> wrote:
>> Ok, downs figured it out on #D. You can't have mixins in templates, which is
>> a big disappointment.
>>
>> Removing the HelloData mixin from HelloSpeaker and all references to
>> helloStr it "works".
> 
> Hmm, didn't know that.  But also if you import a module that uses a
> mixin, the module that uses the mixin also needs to import the mixin
> module.  I'm sure that didn't make any sense.
> 
> I.e. you may need to import mixins.HelloData in mixins.HelloWorld.
> And maybe import all the mixin modules in in main.
> 

Yeah, just tried that and it worked. :) I think all this makes some kind 
of sense, but having to import the module for HelloData in HelloWorld 
shouldn't be needed. It's already been mixed-in in HelloSpeaker so from 
the HelloWorld's standpoint there is no HelloData. But any way glad to 
have it working.

O.


More information about the Digitalmars-d-learn mailing list