Bill Baxter wrote:
On Mon, Dec 15, 2008 at 5:58 PM, Olli Aalto <[email protected]> wrote:
Bill Baxter wrote:
On Mon, Dec 15, 2008 at 5:48 PM, Olli Aalto <[email protected]> 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.
But modules are inherited privately by default.
If you use "public import blahblah" for the modules the mixins require
then you can get around the problem.
Also there is a trick that I think h3r3tic first noticed -- you can
actually put an import statement inside the template, and at least if
it gets mixed into a class, it will work. May work in other cases
too, but not so sure about that.
Yes, I know that they are private by default and that's great. My point
here is this: (copy pasted from #D)
< Odeamus> the way I see this is that when the HelloWorld sees the mixin
for HelloSpeaker the HelloSpeaker template should already
contain the line "private char[] helloStr" and not the mixin
But any way I wrote couple words about what I was after here:
http://odefu.blogspot.com/2008/12/composite-oriented-programming.html
O.