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.