RFC: Unknown number of parameters syntax

7 views
Skip to first unread message

Greg Youree

unread,
Oct 26, 2007, 8:37:55 PM10/26/07
to Milescript
I think we should have support for functions with an unknown number of
parameters at compile-time. The reason for this is that many
ECMAScript libraries take advantage of this feature, and there is no
good way to "fake" it when creating external wrappers in Milescript.
Here is an example from the EXT 2.0 Beta API.

getStyles( String style1, String style2, String etc. ) : Object

Returns an object with properties matching the styles requested. For
example, el.getStyles('color', 'font-size', 'wid...

Returns an object with properties matching the styles requested. For
example, el.getStyles('color', 'font-size', 'width') might return
{'color': '#FFFFFF', 'font-size': '13px', 'width': '100px'}.

Parameters:

* style1 : String A style name
* style2 : String A style name
* etc. : String

Returns:

* Object The style object

The proposed syntax for Milescript is the following...

public CSSStyle getStyles(String ...);

Inside the getStyles() method, the implementation can scroll through
the arguments object, which will be an Array of the type specified in
the method signature.

However, in this case the getStyles() method is external and so it is
not implemented.


I've posted the above as Ticket #17.

- Greg Youree

Reply all
Reply to author
Forward
0 new messages