passing parameters in a send call.

Dar Scott dsc at swcp.com
Sun May 21 17:17:13 EDT 2006


On May 21, 2006, at 2:42 PM, Andre Garzia wrote:

> I am using a script code that is built in runtime and executed with  
> a "do" call. The code calls a send function. I know you can use  
> send with parameters like:
>
> send "myAdd 2, 2" to stack "someStack"
>
> this works. but sending an array like
>
> send "myAdd pArrayA" to stack "someStack"
>
> causes the myAdd handler to be called with an empty parameter. Does  
> anyone here have a clue about that? If this is indeed not possible.

This is a known limitation that is related to a question of whether  
an array is really a value.  Several array enhancements including  
including one that addresses your concern have just recently been  
lumped together on bugzilla, indicating, I think, that that RunRev  
understands the question.

Parameters in 'send' also have numberFormat applied to them if they  
are the result of arithmetic.  The value() function has additional  
issues, IIRC.

> Do anyone here have a suggestion on how to pass an array to an  
> arbitrary function of a stack that will only be known in runtime.

Perhaps you can temporarily put the stack script into the front  
scripts.  If you have control of the stack, you can change it to take  
a flattened stack.

The array-as-value issue goes like this:  In programming languages  
arrays are either a property of a variable (or otherwise related to  
variables) or a type of value.  In Rev, arrays are in between, a  
straddling that adds to confusion, as in this case.  Arrays should  
move off that limbo.  Some folks like the notion that arrays should  
be first class values... that arrays should be allowed as elements of  
arrays, that array values returned from functions can be passed to  
other functions, that arrays should be allowed in send, and so on.   
You might want to look at Bug 3610 and all the others it consolidates  
and see if you agree.

Being a Scheme programmer, Andre, you probably have a better grasp of  
the issues than, say, one whose background is in C programming.

Dar Scott




More information about the use-livecode mailing list