Function Arguments

Questions and answers regarding the use of eclipse environment as seen in Servoy Developer

Function Arguments

Postby gdotzlaw » Tue Aug 04, 2009 5:30 pm

This is an old feature request with many posts. Problem is, it still hasn't been implemented as of Servoy 4.1.

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?
Gary
---------------------------------------------
Dotzlaw Consulting
User avatar
gdotzlaw
 
Posts: 106
Joined: Fri Jul 13, 2007 11:17 pm
Location: Winnipeg, MB, Canada

Re: Function Arguments

Postby ROCLASI » Tue Aug 04, 2009 6:05 pm

gdotzlaw wrote:Is this something we can expect in Servoy 5?


If I were you I'd consider joing the Servoy Tano beta program
http://blog.servoy.com/2009/07/31/servo ... -launched/
And all will be revealed. (of course it requires you are actually gonna actively test it)
;)
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium


Return to Eclipse Environment

Who is online

Users browsing this forum: No registered users and 2 guests