[Laszlo-dev] For Review: Change 20061102-ptw-6 Summary: Implement super.apply
P T Withington
ptw at openlaszlo.org
Fri Nov 3 05:20:43 PST 2006
On 2006-11-02, at 22:23 EST, Philip Romanik wrote:
> Approved, with 3 comments.
>
> 1. WEB-INF/lps/config/lps.properties. I don't think you intended
> this change to be in the changeset. This line is now enabled,
> compiler.warn.globalassignments=true
>
> 2. build.properties. I don't think you intended this change to be
> in the changeset. This line is now disabled,
> #build.lfc.runtime.swf8 = true
Indeed, I do not mean either of these to be in the changeset.
Thanks. I wish there were a way to locally override things like this
in the build system without editing the files (and accidentally
checking them in).
> 3. I only found one place where
> super.initialize.apply(this, arguments);
> appears a little out of place. In LaszoEvents.lzx, the initialize()
> method for LzDelegate and LzEvent bears no resemblance to the base
> class,
> LzDelegate: function initialize (context, functionName,
> eventSender, eventName);
> LzEvent: function initialize ( eventSender , eventName , d );
>
> In this case, don't you think it would be more robust to call
> super.initialize() to emphasize that the parameters aren't used by
> any base class?
I tend to think it is better to pass all arguments _unless_ you
intend to modify them for the super classes. That idiom makes it
clear that I am not doing anything special when calling the
overridden method, and should I change the superclass, I know I don't
have to think about overridden methods with this standard pattern
(whereas I will have to think about methods that massage the
arguments before calling the super method). So I am going to leave
that.
In the specific case of initialize, we probably should only have one
argument, a hash of parameters that each initialize method can pick
out what it needs from. Or, if we had keyword arguments, we should
only allow those. Positional arguments in methods that are defined
on Instance are just asking for trouble.
> Phil
>
>
>> Change 20061102-ptw-6 by ptw at tin-woodsman.local on 2006-11-02
>> 14:34:31 EST
>> in /Users/ptw/OpenLaszlo/legals-2
>>
>> Summary: Implement super.apply
>>
>> Bugs Fixed:
>> LPP-NaN: Should be able to apply super method to arguments
>>
>> Technical Reviewer: pbr (pending)
>> QA Reviewer: jgrandy (pending)
>> Doc Reviewer: jsundman (pending)
>>
>> Documentation:
>>
>> When overriding a method you typically will want to call the
>> overridden method to maintain superclass behavior. The most
>> general way to do this is to say:
>>
>> super.<method>.apply(this, arguments);
>>
>> This will call the overriddent methods with all the arguments your
>> method was called with. It avoids the issue of the argument list
>> changing (or being variable) and the arguments to the super call
>> not getting updated.
>>
>> Details:
>> Parser: parse super.<name>.{call,apply}
>>
>> CodeGenerator, JavascriptGenerator: process the new forms
>>
>> *: Use the new syntax where applicable
>>
>> Tests:
>> ant lztest; lzpix
>>
>> Files:
>> M WEB-INF/lps/lfc/kernel/swf/LzLibrary.lzs
>> M WEB-INF/lps/lfc/kernel/swf/LzLoader.lzs
>> M WEB-INF/lps/lfc/kernel/swf/LzMediaLoader.lzs
>> M WEB-INF/lps/lfc/kernel/swf/LzLibraryLoader.lzs
>> M WEB-INF/lps/lfc/core/LzNode.lzs
>> M WEB-INF/lps/lfc/core/UserClass.lzs
>> M WEB-INF/lps/lfc/views/LzScript.lzs
>> M WEB-INF/lps/lfc/views/LzInputText.lzs
>> M WEB-INF/lps/lfc/views/LzText.lzs
>> M WEB-INF/lps/lfc/views/platform/swf/LzDrawView.lzs
>> M WEB-INF/lps/lfc/views/platform/dhtml/LzDrawView.lzs
>> M WEB-INF/lps/lfc/views/LaszloView.lzs
>> M WEB-INF/lps/lfc/views/LaszloCanvas.lzs
>> M WEB-INF/lps/lfc/helpers/LzFont.lzs
>> M WEB-INF/lps/lfc/helpers/LzCommand.lzs
>> M WEB-INF/lps/lfc/helpers/LzSelectionManager.lzs
>> M WEB-INF/lps/lfc/helpers/LzState.lzs
>> M WEB-INF/lps/lfc/events/LaszloEvents.lzs
>> M WEB-INF/lps/lfc/controllers/LzAnimatorGroup.lzs
>> M WEB-INF/lps/lfc/controllers/LaszloLayout.lzs
>> M WEB-INF/lps/lfc/controllers/LaszloAnimation.lzs
>> M WEB-INF/lps/lfc/data/LzLazyReplicationManager.lzs
>> M WEB-INF/lps/lfc/data/LzReplicationManager.lzs
>> M WEB-INF/lps/lfc/data/platform/swf/LzConnectionDatasource.lzs
>> M WEB-INF/lps/lfc/data/platform/swf/LzConnection.lzs
>> M WEB-INF/lps/lfc/data/LzDatapointer.lzs
>> M WEB-INF/lps/lfc/data/LzDataText.lzs
>> M WEB-INF/lps/lfc/data/LzDataElement.lzs
>> M WEB-INF/lps/lfc/data/LzDataset.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/config/lps.properties
>> M WEB-INF/lps/server/sc/src/org/openlaszlo/sc/Parser.jjt
>> M WEB-INF/lps/server/src/org/openlaszlo/sc/
>> JavascriptGenerator.java
>> M WEB-INF/lps/server/src/org/openlaszlo/sc/CodeGenerator.java
>> M build.properties
>>
>> Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20061102-
>> ptw-6.tar
>
More information about the Laszlo-dev
mailing list