Henry and I are proposing:
1) Use a sentinel rather than null for declared events. This is
typesafe, will not crash Javascript, and can be optimized as necessary.
2) setAttribute, which is the primary caller of sendEvent and likely
to be impacted performance-wise, will be re-written to be careful
about undeclared events and to not make function calls to the
sentinel event. (Safe, will not crash, can be optimized.)
3) The compiler will inline setAttribute and sendEvent. (It used to
inline setAttribute, that was turned off because it conflicted with
registers, is fairly easy to reintroduce. It should be easy to
inline enough of sendEvent to avoid unnecessary function calls.)
On 2006-05-16, at 12:43 EDT, Jim Grandy wrote:
> On May 16, 2006, at 7:42 AM, Amy Muntz wrote:
>
>> Task 2
>> Then, please use the DeclareEvent pattern, and remove the if's as
>> you no longer have to check for null. Please do this in the same
>> set of files you are currently working with, and then send that
>> out for review (Henry has volunteered to review this next
>> changeset - thanks, Henry!)
>
> Woah. The DeclareEvent isn't where the if's are -- it's in the
> sendEvent idiom we use. We'd need a SendEvent standalone function
> to get rid of the if's.
>
> SendEvent = function(evt, arg) {
> if (evt != null) evt.sendEvent(arg);
> }
>
> Then we can rewrite the body of SendEvent if the semantics change.
>
> Or am I confused? Can someone please write up a mini-proposal for
> what we're doing?
>
> Thanks,
>
> jim
_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev