[Laszlo-dev] For Review: Change 20080423-dda-7 Summary: SWF9: Provide simple workaround for mixins that use unknown super classes

Donald Anderson dda at ddanderson.com
Wed Apr 23 20:04:23 PDT 2008


Yes, I see the errors, but they seem like legitimate errors for a  
statically typed class.
I don't see moveTo() in LzView or the mixin, but it is called from the  
mixin.
Maybe moveTo needs to be defined as a blank (abstract?) function in  
the mixin.
Then later it will be defined for real in $lzsc$class_drawview.


On Apr 23, 2008, at 5:51 PM, Max Carlson wrote:

> Approved!
>
> This change helps, but now I'm getting tripped up trying to use  
> methods that exist in the class it's being mixed into.  If you apply  
> this patch:
>
> Index: lps/components/extensions/drawview.lzx
> ===================================================================
> --- lps/components/extensions/drawview.lzx      (revision 8835)
> +++ lps/components/extensions/drawview.lzx      (working copy)
> @@ -257,6 +257,10 @@
>   <!-- these methods are shared across runtimes -->
>   <script when="immediate"><![CDATA[
>     mixin DrawviewShared {
> +        function DrawviewShared ( parent:LzView? = null ,  
> attrs:Object? = null , children:Array? = null, instcall:Boolean  =  
> false) {
> +            super(parent,attrs,children,instcall);
> +        }
> +
>         function arc(x, y, radius, startAngle, endAngle, clockwise) {
>             var sx = x + radius*Math.cos(startAngle);
>             var sy = y + radius*Math.sin(2 * Math.PI - startAngle);
>
> and run http://localhost:8080/trunk/test/drawing/drawing.lzx? 
> lzr=swf9 you'll see what I mean - there are lots of 'possibly  
> undefined method' warnings like this:
>
> line 271: Error: Call to a possibly undefined method moveTo through  
> a reference with static type $lzsc$mixin$DrawviewShared$LzView, in  
> line: this.moveTo(sx, sy);
>
>
> Donald Anderson wrote:
>> Change 20080423-dda-7 by dda at lester.local on 2008-04-23 17:11:40 EDT
>>    in /Users/dda/laszlo/src/svn/openlaszlo/trunk
>>    for http://svn.openlaszlo.org/openlaszlo/trunk
>> Summary: SWF9: Provide simple workaround for mixins that use  
>> unknown super classes
>> New Features:
>> Bugs Fixed: LPP-5841
>> Technical Reviewer: ptw (pending)
>> QA Reviewer: max (pending)
>> Doc Reviewer: (pending)
>> Documentation:
>> Release Notes:
>> Details:
>>    When a mixin uses a superclass not known in the current  
>> compilation, instead
>>    of rejecting this, we allow a simple workaround: the mixin must  
>> be coded with
>>    a constructor, and the programmer takes responsibility for the  
>> constructor
>>    working with whatever superclasses the mixin can be used with.
>>    Conversely, if there is no mixin constructor, then either the  
>> superclass must be known in the current
>>    compilation, or there may be no superclass.
>>    A more sophisticated solution (having real knowledge of all  
>> potential superclasses) awaits
>>    for another time.
>> Tests:
>>    Ran regression tests: smokecheck,weather,lzpix  X  swf8,dhtml
>>    Tried some simple tests for functionality:
>>      ====
>>      mixin DrawviewShared {
>>        var floobar;
>>          function DrawviewShared () {
>>            super();
>>            floobar = 42;
>>          }
>>      }
>>      class mydrawview extends LzView with DrawviewShared {
>>      }
>>      //Uncommenting this should give an error - we must supply
>>      // a constructor for badbad if we use it with an 'unknown'
>>      // superclass like LzView.
>>      //class mybad extends LzView with badbad {
>>      //}
>>      mixin badbad {
>>        // no constructor
>>      }
>>      ====
>> Files:
>> M      WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9Generator.java
>> Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20080423-dda-7.tar
>> -- 
>> Don Anderson
>> Java/C/C++, Berkeley DB, systems consultant
>> voice: 617-547-7881
>> email: dda at ddanderson.com
>> www: http://www.ddanderson.com
>
> -- 
> Regards,
> Max Carlson
> OpenLaszlo.org


--

Don Anderson
Java/C/C++, Berkeley DB, systems consultant

voice: 617-547-7881
email: dda at ddanderson.com
www: http://www.ddanderson.com






More information about the Laszlo-dev mailing list