Paramcount caution

Dar Scott dsc at swcp.com
Fri Dec 27 14:18:01 EST 2002


On Friday, December 27, 2002, at 11:06 AM, Jim Hurley wrote:

> But that will be a problem in handlers which count parameters in this 
> way. I get the feeling there is a subtle difference between "empty" and 
> "missing"???????

The number of parameters is statically defined by the caller and is 
specified by the number of arguments.  It has nothing to do with the 
nature of the data.  In your example, the first call to print 1 has one 
parameter and the second call has two.

The function params() can be easily fooled, but with "do", paramCount() 
and param(), you should be able to do what you want.

(If you want to pass arrays, then you may need to limit the number of 
args and put variable names in the "do" string instead of param().  
Arrays lose their values if a returned value and a parameter in the same 
expression.  I think numbers will be OK.)

The subtle difference between empty and missing is the paramCount() in 
the called handler and in the actual args in the calling line of the 
calling handler.

Dar Scott




More information about the Use-livecode mailing list