[Laszlo-dev] as3 compiler doesn't like fancy default values

Henry Minsky hminsky at laszlosystems.com
Wed Sep 10 19:57:06 PDT 2008


When we have default values like this, something complains in the flex
compiler

 function toArray (linkMaker=function (rep, id) {return
Debug.ObjectForID(id);}):Array {

     [java] [/tmp/lzswf9/lzgen27609/LzDebugMessage.as: 188]
debugger/LzMessage.lzs: 200: Error: Parameter initializer unknown or is not
a compile-time constant.

So I have been converting complex initializers like that into null default
args, and initializing in the function body, like this

+  function toArray (linkMaker=null):Array {
+    if (linkMaker == null) {
+      function (rep, id) {return Debug.ObjectForID(id);}
+    }




-- 
Henry Minsky
Software Architect
hminsky at laszlosystems.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20080910/6e7237f7/attachment.html


More information about the Laszlo-dev mailing list