[Laszlo-dev] Documenting rest args

P T Withington ptw at pobox.com
Sat Jun 28 10:48:03 PDT 2008


Hurray!

The '|' is almost JS2 -- that is how you express a union type.  But I  
don't know how you express a singleton type.  When we say `1|2` we  
really mean `singleton(1)|singleton(2)`.

On 2008-06-28, at 10:29 EDT, Donald Anderson wrote:

> 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
>
>
>



More information about the Laszlo-dev mailing list