[Laszlo-dev] Including an instance
Rami Ojares / AMG Oy
rami.ojares at archon.fi
Fri Dec 4 06:46:38 PST 2009
> I'd be interested to know more about the specific issue the swf10
> compiler was having a problem with. The LZX compiler is supposed to
> 'do the right thing' for you. It does not actually write the mixin
> out as a class -- it just uses it as a template to write the flattened
> class chain that your mixins specify. So, I think there is either a
> bug in the compiler, or a bug in your modularization.
The following code is created to demonstrate how swf10 compiler treats mixins. You can then decide whether you think
this is appropriate or not.
This example WORKS in swf8.
Compiling to swf10 the following error is produced:
Stray error string from external compiler:
/opt/prg/tomcat/apache-tomcat-6.0.18/temp/lzswf9/opt/prg/tomcat/apache-tomcat-6.0.18/webapps/exodus/test/build/churchill_dry_martini/$lzc$class_quick_glance_at_a_bottle_of_vermouth$view.as(9):
sar.: 1 Virhe: Call to a possibly undefined method sip_and_contemplate
("Virhe" means "error" in english)
File churchill_dry_martini.lzx
-------------------------------
<canvas debug="true">
<include href="tall_glass_of_gin.lzx"/>
<include href="quick_glance_at_a_bottle_of_vermouth.lzx"/>
<class name="churchill_dry_martini" with="tall_glass_of_gin, quick_glance_at_a_bottle_of_vermouth">
<method name="sip_and_contemplate">
Debug.write("I do not understand this squeamishness about the use of gas. \
We have definitely adopted the position at the Peace Conference of \
arguing in favour of the retention of gas as a permanent method of warfare. \
It is sheer affectation to lacerate a man with the poisonous fragment of a \
bursting shell and to boggle at making his eyes water by means of lachrymatory gas. \
I am strongly in favour of using poisoned gas against uncivilised tribes. \
The moral effect should be so good that the loss of life should be reduced to a minimum. \
It is not necessary to use only the most deadly gasses: gasses can be used which\
cause great inconvenience and would spread a lively terror and yet would leave no \
serious permanent effects on most of those affected.");
</method>
</class>
<churchill_dry_martini>
<handler name="oninit">
pourGin();
</handler>
</churchill_dry_martini>
</canvas>
File tall_glass_of_gin.lzx
-------------------------------
<library>
<mixin name="tall_glass_of_gin">
<method name="pourGin">
Debug.write("Take a long glass");
Debug.write("Pour it full of Bombay Sapphire");
glanceAtVermouth();
</method>
</mixin>
</library>
File quick_glance_at_a_bottle_of_vermouth.lzx
---------------------------------------------
<library>
<mixin name="quick_glance_at_a_bottle_of_vermouth">
<method name="glanceAtVermouth">
Debug.write("Just a quick glance. It's enough.");
sip_and_contemplate();
</method>
</mixin>
</library>
More information about the Laszlo-dev
mailing list