[Laszlo-dev] Optional/typed arguments in script now supported

André Bargull a.bargull at intensis.de
Fri Mar 21 07:28:01 PDT 2008


(Btw, for your recent change "Redefine LzCursor using 'modern O-O'", 
you've used type declarations for the "LzCursorInterface".)
Proposal:
For both LPP-737 and LPP-5648 (trunk), I won't add type declarations. 
But I'll mail the typed version of LzParsedPath to Henry (?) to 
integrate it into devildog, because there you'll need it. And after the 
devildog merge, I'm going to commit my changes for LPP-654.
So, all I need to do now, is to revert my local version to the different 
versions for trunk and devildog. Ok so far?

On 3/21/2008 1:49 PM, P T Withington wrote:
> The question is:  if we add type declarations in ringding, where they 
> will not be checked, are we laying a landmine for integrating to 
> devildog where they will?  I tend to think we should not add type 
> declarations in ringding, for now.  We expect to bring devildog back 
> to trunk "real soon now", at which point, adding type declarations 
> will be meaningful and testable.
>
> On 2008-03-20, at 20:16 EDT, André Bargull wrote:
>> I'm going to change LzParsedPath to fix LPP-737 and LPP-5648 (for 
>> trunk), should I add type declarations wherever possible, even if it 
>> isn't the devildog branch?
>>
>> - André
>>
>>> As of r8198 in trunk, you can now write:
>>>
>>> function foo (x:Number, y:String = "", ...rest) { ... }
>>>
>>> That is, you can add type declarations (which are ignored at 
>>> present  for JS1-based run times), you can give default values for 
>>> optional  arguments, and you can have a "rest" argument that will 
>>> pick up any  additional arguments into an array.
>>>
>>> This is the syntax that will eventually be supported by Javascript 
>>> 2,  but we (thanks Don!) have implemented it in our script compiler 
>>> so  that it can be used in Javascript 1 runtimes too.
>>>
>>> There is a test in test/optarg.lzx, if you want to see more examples.
>>
>
>


More information about the Laszlo-dev mailing list