associative arrays

Robert Brenstein rjb at rz.uni-potsdam.de
Fri Dec 13 13:56:01 EST 2002


>On Friday, December 13, 2002, at 02:47 AM, Robert Brenstein wrote:
>
>>However, I need to pass it as an argument to a function that is 
>>dynamically defined and executed through do.
>>
>>put webArg into fName -- let's say webArg = somfunction
>>
>>do "get" && fName & "(" & myArray & ")"
>>
>>function somfunction myArray
>>return myArray[key]
>>end somfunction
>>
>>In somfunction, the associative array give empty values for key and 
>>array elements.
>
>I have seen other limitations.  I can return an array from a 
>function and pass an array as a parameter but not both in the same 
>expression as in somFunction(buildArray()).
>
>I have been successful in this:
>do "someHandler a b c"
>where c is a handler local variable containing an array.
>
>You may want to experiment with value().
>
>I hope you mention how you solve this.
>
>Dar Scott
>(a Revolution user sitting in the back row)

I found a workabout not the solution. Only Scott can tell us whether 
failure to pass associative array is a bug or a feature. Sounds like 
a bug to me (do parser not passing the correct thing).

My program is a CGI and I split incoming web arguments in a front 
script that does pre-handling. A nice and clean solution would be to 
simply pass the array further to the function that actual processing. 
The workabout is that I pass raw web arguments and redo the split in 
each function. Waste of some cpu cycle but mostly the elegance -- the 
handler functions are provided my different people and I wanted to 
hide the direct handling of arguments. Oh, well.

Robert



More information about the metacard mailing list