[Laszlo-dev] Optional/typed arguments in script now supported
André Bargull
a.bargull at intensis.de
Thu Mar 20 17:16:18 PDT 2008
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