Rex

Call function vs function($par)

5 posts in this topic

Hi

Sry if there is an answer somewhere in the help file or in som other post at the forum (I did a search but didn't find any though), and the help file only tells me how to use the Call not if it's better, faster, simpler that the "standard" way.

Is there any benefit by using call function, $par over just use the func($par)

I have seen som snipets that uses the call function  rather than use the function($par)

 

Cheers
/Rex

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

For me, Call has to be used in the case where you don't know in advance the function name to call (when the function name is stored in a variable as string for example).
For example, I used Call in _MultiProcess UDF : the function _MultiProcess_SetOnEvent allows the programmer to set a function name to call when a special event appears. Here, the function name is stored in a variable as string, so Call seems suitable.
 

Edited by jguinch

Share this post


Link to post
Share on other sites
4 hours ago, jguinch said:

For me, Call has to be used in the case where you don't know in advance the function name to call (when the function name is stored in a variable as string for example).
For example, I used Call in _MultiProcess UDF : the function _MultiProcess_SetOnEvent allows the programmer to set a function name to call when a special event appears. Here, the function name is stored in a variable as string, so Call seems suitable.
 

For that I see the idea, but the snip I saw the call in it was just Call(Functionname, 'par') where I would had used FunctionName('par')

Cheers
/Rex

Share this post


Link to post
Share on other sites
16 minutes ago, JohnOne said:

Since functions are now first class objects, using Call may very well be obsolete.

Still the way  jguinch  use the Call makes sense.

Cheers
/Rex

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now