I think we need something that avoids the function call. Some of these events are fired at object construct/init time and the function call overhead can be high in aggregate.

But if events are initialized to a singleton dummy, couldn't we check for that value instead of null?

I confess, though, if we have to do a compare anyway, why go to a dummy singleton? Why not just stay with the current practice (in lps-dev) of initializing to null?

The separate question is whether to move to a construct that is inlined and does whatever check automatically. But this is truly separate -- we could add a SendEvent(evt, arg) primitive that is inlined by the caller and does the same as whatever check we agree to.

jim

On May 15, 2006, at 3:40 PM, Henry Minsky wrote:

  In some cases I added initial values to the object and set them to
        null. For example, many classes call events that have not been
        initialized. In addition to initializing them to null, the code now
        checks by,

            if (this.onload)
                this.onload.sendEvent (this);


Hmm, in the DHTML runtime, we had started declaring undefined events on classes
by using a new function, DeclareEvent, which would use a singleton dummy event object. But I am not sure if it's worth going back and fixing these to work that way or not.

In LaszloCanvas.js, for example, we added

DeclareEvent(LzCanvas.prototype, 'onaddsubview' );
DeclareEvent(LzCanvas.prototype, 'onremovesubview' );

The issue is that if we use this, then it costs a function call to find out
the thing is a dummy event. Tucker had talked about hacking the compiler
itself to special case sendEvent to do the null check first also. Anyone
have a clear favorite policy to deal with these undeclared events?



On 5/15/06, Philip Romanik <[EMAIL PROTECTED]> wrote:
Change 42262 by [EMAIL PROTECTED] on 2006/05/15 17:17:10 *pending*

        Summary: Cleanup LFC Warnings

        Bugs Fixed:
        LPP-2034 Cleanup LFC Warnings

        Technical Reviewer: ptw (pending)
        QA Reviewer: jgrandy (pending)
        Doc Reviewer: jsundman (pending)

        Documentation:

         I followed the instructions listed in LPP-2034 to build a runtime
         that reports warnings and errors when simple.lzw is executed. Most
         errors are caused by uninitialized variables or improperly testing
         if a property or method is defined.

         In some cases I added initial values to the object and set them to
         null. For example, many classes call events that have not been
         initialized. In addition to initializing them to null, the code now
         checks by,

             if (this.onload)
                 this.onload.sendEvent (this);

         In other places, the 'in' operator is used to test a variable
         before it is used. I only changed code that reported a warning
         or error, or was similar to the code that produced a warning
         or error.

        Tests:

         test/smoke/simple.lzx
         test/smoke/delay.lzx

Affected files ...

//depot/lps-legals/WEB-INF/lps/lfc/core/Library.lzs#3 edit
//depot/lps-legals/WEB-INF/lps/lfc/core/LzClass.as#6 edit
//depot/lps-legals/WEB-INF/lps/lfc/core/LzNode.as#7 edit
//depot/lps-legals/WEB-INF/lps/lfc/core/UserClass.as#5 edit
//depot/lps-legals/WEB-INF/lps/lfc/data/LzDataElement.lzs#2 edit
//depot/lps-legals/WEB-INF/lps/lfc/data/LzDataText.lzs#2 edit
//depot/lps-legals/WEB-INF/lps/lfc/data/LzDatapath.as#2 edit
//depot/lps-legals/WEB-INF/lps/lfc/data/LzDataset.as#3 edit
//depot/lps-legals/WEB-INF/lps/lfc/data/LzDatasource.as#4 edit
//depot/lps-legals/WEB-INF/lps/lfc/data/LzHTTPDatasource.as#3 edit
//depot/lps-legals/WEB-INF/lps/lfc/data/LzLoader.as#4 edit
//depot/lps-legals/WEB-INF/lps/lfc/events/LaszloEvents.lzs#3 edit
//depot/lps-legals/WEB-INF/lps/lfc/glue/LaszloInitiator.as#3 edit
//depot/lps-legals/WEB-INF/lps/lfc/services/LzBrowser.as#2 edit
//depot/lps-legals/WEB-INF/lps/lfc/services/LzFocus.as#3 edit
//depot/lps-legals/WEB-INF/lps/lfc/services/LzFontManager.as#2 edit
//depot/lps-legals/WEB-INF/lps/lfc/services/LzHistory.as#3 edit
//depot/lps-legals/WEB-INF/lps/lfc/services/LzIdle.as#1 edit
//depot/lps-legals/WEB-INF/lps/lfc/services/LzInstantiator.as#3 edit
//depot/lps-legals/WEB-INF/lps/lfc/services/LzKeys.as#5 edit
//depot/lps-legals/WEB-INF/lps/lfc/services/LzLoadQueue.as#6 edit
//depot/lps-legals/WEB-INF/lps/lfc/services/LzModeManager.as#2 edit
//depot/lps-legals/WEB-INF/lps/lfc/services/LzTimer.as#2 edit
//depot/lps-legals/WEB-INF/lps/lfc/views/LaszloCanvas.as#5 edit
//depot/lps-legals/WEB-INF/lps/lfc/views/LaszloView.as#11 edit



_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev






--
Henry Minsky
Software Architect
[EMAIL PROTECTED]

_______________________________________________
Laszlo-dev mailing list

_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev

Reply via email to