associative arrays

Dar Scott dsc at swcp.com
Fri Dec 13 19:50:01 EST 2002


On Friday, December 13, 2002, at 04:34 PM, Scott Raney wrote:

> This is because you can only pass arrays using *variables*, not as the
> return value of a function call.  In C/C++/Java, trying to do the
> above where "someFunction" takes a reference would generate a syntax
> error.  MC/RR, being an untyped language, just silently takes the
> scalar value (which in this case will be empty) if it can't find a
> variable when it gets to the called function.

Yeah, arrays seem to have something to do with variables in most 
programming languages.  Some languages, though, allow arrays to be full 
values and not special kinds of variables.  Examples are LabView, some 
dialects of lisp and almost C++ (vectors).  I was wishing for and 
encouraging that kind of thing.

I don't think MC/RR is far from that.  It seems to be almost there.  
Maybe it can work like this:  The scalar value can be "taken" only when 
a string is absolutely required.  I'm thinking of expressions like 'x & 
empty' or commands like 'put x into field "A"'.  When conversion is not 
required, then the array--as value--is passed around.  This means 
especially as parameters and as returned values.  Just as an internal 
number can get about and converted to a string as needed, so should an 
array.  This allows folks like me to use a functional programming style 
without it getting in the way of those who prefer to think of arrays as 
something to do with variables.

Dar Scott
(causing confusion in the back row)





More information about the metacard mailing list