Here is an excerpt from the Servoy 4.1 Help file:
Function parameters and arguments
A standard JavaScript function (JS Lib) or a built-in Servoy function may have zero or more (required or optional) parameters or arguments - data that can be used when processing a function.
The syntax (structure) of a JS Lib or Servoy function includes:A set of open and closed parentheses ( ) after the function name.
- Any parameters or arguments enclosed within the parentheses.
- Multiple parameters or arguments separated by a comma , .
- Optional parameters enclosed by a set of open and closed brackets [ ].
I thought that maybe since in Servoy 4, all methods are now functions, that this could mean that I could write a global method something like this (lame example, I know):
function myMethod(iLength, iWidth)
{
return iLength * iWidth;
}
so argument[0] is assigned to the first var, and agrument[1] is assigned to the second, but more importantly, when I call the method and write "globals.myMethod" code assist would show me "iLength, iWidth" in a popup. This would enable me to call the method and pass the arguments without having to navigate to the method to see what it expects to be passed.
I was quite excited to give this a try, thinking that this feature which is typical of other IDEs had been implemented. Sadly, when I wrote the method and pressed Save, the method was reformatted to look like:
function myMethod()
{
return iLength * iWidth;
}
which won't work of course, so I have to modify to the old way of writing a method in Servoy which is:
function myMethod()
{
iLength= arguments[0];
iWidth= arguments[1];
return iLength * iWidth;
}
I think this really needs to be implemented. A new developer looking at Servoy that is familiar with Javascript would expect this and would be quite surprised to learn that it is not supported.
Is this something we can expect in Servoy 5?