[Laszlo-dev] Documenting rest args

Donald Anderson dda at ddanderson.com
Sat Jun 28 07:29:19 PDT 2008


In case you didn't notice, you can now use javadoc to document

    -    'rest' optional args (using '...rest')
    -    Array types (e.g. [String])
    -    'any' type ('*')
    -    'choices'  (e.g. '1|2|3').

The last is our own javadoc extension, the others all correspond
to new JS2 type syntax.

So you don't get tripped up, here's a more accurate telling.
We allow a javadoc type to be a sequence of 'word' characters
(alphanum) along with *,|,[,].   No spaces are allowed in the type.
We don't do any further checking - this is all matched with a
regular expression.  And the identifier can have an
optional '...' preceding it.

On Apr 24, 2008, at 8:51 AM, P T Withington wrote:

> What's the syntax for documenting a rest arg?
>
> In Javascript, I would write:
>
>  function foo(...rest:[String])
>
> if I wanted a function that took any number of Strings as its  
> arguments.  In our doc comments, we have this inverted syntax where  
> you specify the type before the parameter name, so do I say:
>
>  @param [String] ...rest: <description>


yes.

--

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

voice: 617-547-7881
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/20080628/b3a3eedf/attachment.html


More information about the Laszlo-dev mailing list