Function Parameters

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

Function Parameters

Postby Yeroc » Fri Nov 21, 2008 2:07 am

When defining a function in my form I wanted to specify the parameters like so:
Code: Select all
function myFunction(id, pageCount)
{
...
}


But Servoy (v4.1.0 rc1 at least) doesn't seem to like this syntax and "eats" the parameters as soon as I save(!). Any ideas why this syntax isn't allowed? It much less verbose and cleaner than (IMO):
Code: Select all
function myFunction()
{
  var id = arguments[0]
  var pageCount = arguments[1]
...
}


As far as I can tell Rhino (the javascript implementation used by Servoy) supports this syntax.

Is this a bug?
Yeroc
 
Posts: 109
Joined: Tue Aug 12, 2008 1:12 am
Location: Calgary, AB, Canada

Re: Function Parameters

Postby ROCLASI » Fri Nov 21, 2008 9:01 am

Hi Yeroc,

Yeroc wrote:As far as I can tell Rhino (the javascript implementation used by Servoy) supports this syntax.

Is this a bug?


It's a 'feature' ;)
It's the way Servoy always worked but I understand that they will support it in some future version.
So it's on the list.

Right now you can use function parameters with functions INSIDE your methods but the methods themselves you need to use the arguments array approach.

Hope this helps
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 4 guests