[Laszlo-dev] For Review: Change 20090225-dda-V Summary: do not drop 'void' return types

Donald Anderson dda at ddanderson.com
Fri Feb 27 13:20:46 PST 2009


On Feb 27, 2009, at 3:46 PM, P T Withington wrote:

> On 2009-02-27, at 15:37EST, Donald Anderson wrote:
>
>> On Feb 27, 2009, at 12:11 PM, P T Withington wrote:
>>
>>> I think you've gone overboard with the LFC changes.  In some  
>>> places the right fix is to make the method final, rather than  
>>> remove the declaration.
>>
>> Most of these changes were made because the functions were  
>> overridden (or in one case called) inconsistently within the LFC.
>> So I needed to change something, either in the base class or  
>> inherited to make the LFC compile.  That said, I agree, some of them
>> could also be declared final to prevent outside overrides.  The  
>> other few changes (*SelectionManager) were made because the  
>> components
>> override the methods, so they can't be declared final.
>>
>>> callJS should be final
>>
>> LzBrowserService class is already marked final, so final on a  
>> method is redundant.
>
> Then you don't need to change the signature?

I still do.  callJS is the oddball of the bunch.  I needed to change  
the return type, not because of override, but because
it really returns something, so the error was returning something from  
a method marked :void.

     function callJS (methodname:String, callback:Function = null,  
args:* = null) {
         try {
             return LzBrowserKernel.callJS.apply(null, arguments);
         } catch (e) {
             if ($debug) Debug.error('lz.Browser.callJS() failed:', e);
         }
     }

It turns out that in the DHTML kernel (only) callJS returns a value.   
The others don't.
The jsdoc appears to be correct:

      * Runs a Javascript method in the browser, optionally returning  
the result.

Maybe better to declare all the callJS() as return '*', and for good  
form,
add 'return null' to the SWF8/SWF9 kernels?


--

Don Anderson
Java/C/C++, Berkeley DB, systems consultant

voice: 617-306-2057
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/20090227/046474f6/attachment.html


More information about the Laszlo-dev mailing list