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.

Reply via email to