[Laszlo-dev] For Review: Change 20081021-dda-p Summary: Add return type declarations to SWF9 [2nd review]
Donald Anderson
dda at ddanderson.com
Sun Oct 26 14:00:59 PDT 2008
Thanks for the reminder, Andre, I've filed these JIRA to track these
issues:
http://www.openlaszlo.org/jira/browse/LPP-7244
http://www.openlaszlo.org/jira/browse/LPP-7243
- Don
On Oct 25, 2008, at 3:48 PM, André Bargull wrote:
> LzDatapointer#setXPath's return type is "Boolean?", but there are no
> nullable Boolean in AS3, so I think we need to change the return
> type to "*".
> Especially because the java-doc described that false and undefined
> have different meanings:
>> * @return Boolean|Undefined: <code>true</code> if the path matches a
>> * single node, <code>false</code> if no or multiple nodes are
>> * matched, <code>undefined</code> if the path is invalid.
> This affects LzDatapointer#setXPath(),
> LzReplicationManager#setXPath() and potentially also
> LzDatapointer#runXPath() (return-type was here "Boolean", maybe it
> should be "*", too).
>
>
> And I guess my comment from a previous mail is still valid (see e.g.
> LPP-7236!):
>> I think we need to remove the return types in
>> LzSelectionManager#isMultiSelect(), #isRangeSelect() (and other
>> public methods which may get overridden by users defined
>> subclasses), because our plan was to make the move from swf8/dhtml
>> to swf9 as easy as possible and without any code changes. [Remove
>> return types at least until the compiler is smart enough to fill in
>> the right types.]
>
> Approved!
>
>
>> In case you want to re-review.
>>
>>
>> Change 20081021-dda-p by dda at lester.local <mailto:dda at lester.local>
>> on 2008-10-21 10:03:53 EDT
>>
>> in /Users/dda/laszlo/src/svn/openlaszlo/trunk-a
>>
>> for http://svn.openlaszlo.org/openlaszlo/trunk
>>
>>
>> Summary: Add return type declarations to SWF9
>>
>>
>> New Features:
>>
>>
>> Bugs Fixed: LPP-7031 (swf9 back-end is dropping return type
>> declarations)
>>
>>
>> Technical Reviewer: ptw (pending)
>>
>> QA Reviewer: andre (pending)
>>
>> Doc Reviewer: (pending)
>>
>>
>> Documentation:
>>
>>
>> Release Notes:
>>
>>
>> Details:
>>
>> In case you want to re-review. I've tried to incorporate your
>> comments.
>>
>> Changed a case in test/smoke/regression.lzl which now expects null
>> instead of
>>
>> undefined. There's a half dozen JIRA's that I'll need to file as a
>> result
>>
>> of the reviews up to now.
>>
>>
>> WEB-INF/lps/server/src/org/openlaszlo/sc/ParseTreePrinter.java
>>
>> WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9ParseTreePrinter.java
>>
>>
>> Explicit return types like Boolean in 'function foo () :
>> Boolean { }' were
>>
>> not being emitted by the SWF9 backend. The fix was
>> straightforward,
>>
>> the fallout was not...
>>
>>
>>
>> WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java
>>
>> WEB-INF/lps/server/src/org/openlaszlo/sc/Method.java
>>
>> WEB-INF/lps/server/src/org/openlaszlo/sc/Function.java
>>
>>
>> Added a "type" attribute to <method> to set the return type.
>>
>> This was needed to get a few cases where lzx code overrides
>> LFC functions (now with return typing!)
>>
>> to compile. This type must be 'Javascript' (i.e. Boolean, not
>> 'boolean' is used).
>>
>> Some cleanup to reduce the number of constructors for Method/
>> Function. I think
>>
>> this makes the code a bit clearer.
>>
>>
>> lps/components/base/datalistselector.lzx
>>
>> lps/components/base/listselector.lzx
>>
>> demos/lzpix/app.lzx
>>
>>
>> Added type="Boolean" to a few methods that override to allow
>> them to compile and
>>
>> run in SWF9.
>>
>>
>>
>> Fixing return typing exposed a lot of 'new' typing in LFC and
>> some in application code,
>>
>> which caused various consistency errors in several categories.
>>
>>
>> - in many .lzs files, functions marked as returning a type did
>> not always
>>
>> explicitly call return, or when they did they did not return a
>> value.
>>
>>
>> * Boolean functions now return false in any added return
>> paths.
>>
>> * Number functions now return NaN in any added return paths.
>>
>> * Object functions now return null in any added return paths.
>>
>> * methods truly not implemented return undefined.
>>
>>
>> The 'String returns null' case exposed a bug in test/smoke/
>> regression.lzl
>>
>> where an 'undefined' was expected, changed to a null expected.
>>
>>
>> Cases that seemed most questionable I marked with:
>>
>> TODO: [20081020 dda] review this return value change from
>> LPP-7031
>>
>>
>>
>> - in several .lzs files, functions marked as override did not
>> always match return types.
>>
>>
>>
>> - in several .lzs files, toString() is marked as :String, but in
>> others it is not.
>>
>> For the moment, it was too big of a job to fix all these as
>> part of this (already
>>
>> large) commit, so typing for this function was commented
>> whenever a
>>
>> compile error showed a mismatch.
>>
>>
>>
>> - in several .lzs files, functions with new typing returned a
>> value but without proper typing.
>>
>> Type casting was added as appropriate.
>>
>>
>>
>> WEB-INF/lps/lfc/kernel/swf9/LzMouseKernel.as:
>>
>>
>> - type of a local variable wasn't narrowly typed enough, leading
>> to
>>
>> errors in return statements.
>>
>>
>>
>> WEB-INF/lps/lfc/debugger/LzDebug.lzs:
>>
>>
>> - __StringDescription() needed to be defined with exactly the
>> same argument signature
>>
>> I don't know why return typing exposed this as a problem.
>>
>>
>>
>> WEB-INF/lps/lfc/data/LzLazyReplicationManager.lzs:
>>
>>
>> - Certain local variables typed as LzView needed typing
>> commented. Initial attempts
>>
>> to fix the typing errors in this file involved casting, e.g.
>>
>> var v:LzView = LzView(this.getNewClone( true ));
>>
>> But these changes broke smokecheck for DHTML. It seems that
>> some assumption
>>
>> about typing is being violated and will need to be tracked
>> down later.
>>
>> I commented out the typing for the local variables, and left
>> TODOs to clean
>>
>> this up later.
>>
>>
>>
>> Note that the compile errors fixed here only show up when
>> building the LFC (or app) for SWF9.
>>
>> In debugging these problems it was most helpful to build the
>> debuglfc to get line number information.
>>
>>
>> Tests:
>>
>> tests: (smokecheck) * (swf8+dhtml)
>>
>> apps: (weather+lzpix) * (swf8+swf9+dhtml), hello(swf9)
>>
>>
>> Files:
>>
>> M test/smoke/regression.lzl
>>
>> M WEB-INF/lps/lfc/kernel/swf9/LFCApplication.as
>>
>> M WEB-INF/lps/lfc/kernel/swf9/LzMouseKernel.as
>>
>> M WEB-INF/lps/lfc/services/LzAudio.lzs
>>
>> M WEB-INF/lps/lfc/debugger/LzDebug.lzs
>>
>> M WEB-INF/lps/lfc/debugger/platform/swf9/LzFlashRemote.as
>>
>> M WEB-INF/lps/lfc/debugger/platform/swf9/LzDebug.as
>>
>> M WEB-INF/lps/lfc/views/LaszloView.lzs
>>
>> M WEB-INF/lps/lfc/controllers/LzAnimatorGroup.lzs
>>
>> M WEB-INF/lps/lfc/controllers/LaszloAnimation.lzs
>>
>> M WEB-INF/lps/lfc/data/LzReplicationManager.lzs
>>
>> M WEB-INF/lps/lfc/data/LzLazyReplicationManager.lzs
>>
>> M WEB-INF/lps/lfc/data/LzDatapointer.lzs
>>
>> M WEB-INF/lps/lfc/data/LzDataText.lzs
>>
>> M WEB-INF/lps/lfc/data/LzDataNode.lzs
>>
>> M WEB-INF/lps/lfc/data/LzDataElement.lzs
>>
>> M WEB-INF/lps/lfc/data/LzResizeReplicationManager.lzs
>>
>> M WEB-INF/lps/lfc/data/LzDatapath.lzs
>>
>> M WEB-INF/lps/lfc/data/LzParam.lzs
>>
>> M WEB-INF/lps/lfc/data/LzDataAttrBind.lzs
>>
>> M WEB-INF/lps/lfc/compiler/LzBootstrapDebugService.lzs
>>
>> M WEB-INF/lps/server/src/org/openlaszlo/sc/Method.java
>>
>> M WEB-INF/lps/server/src/org/openlaszlo/sc/
>> SWF9ParseTreePrinter.java
>>
>> M WEB-INF/lps/server/src/org/openlaszlo/sc/Function.java
>>
>> M WEB-INF/lps/server/src/org/openlaszlo/sc/ParseTreePrinter.java
>>
>> M WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java
>>
>> M lps/components/base/datalistselector.lzx
>>
>> M lps/components/base/listselector.lzx
>>
>> M demos/lzpix/app.lzx
>>
>>
>> Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20081021-dda-p.tar
>>
>>
>>
>>
>> --
>>
>> Don Anderson
>> Java/C/C++, Berkeley DB, systems consultant
>>
>> voice: 617-547-7881
>> email: dda at ddanderson.com <mailto:dda at ddanderson.com>
>> www: http://www.ddanderson.com <http://www.ddanderson.com/>
>>
>>
--
Don Anderson
Java/C/C++, Berkeley DB, systems consultant
voice: 617-547-7881
email: dda at ddanderson.com
www: http://www.ddanderson.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20081026/61750e4d/attachment-0001.html
More information about the Laszlo-dev
mailing list