Passing parameters by reference

Dar Scott dsc at swcp.com
Tue Mar 13 16:19:54 EDT 2012


Hi, Bob!

On Mar 13, 2012, at 9:37 AM, Bob Sneidar wrote:
> That is what passing an element to an array amounts to was my point. I think what you are calling a statement many will call an expression.  

This concern is understandable.  However, I think we can distinguish between an expression that means a value and an expression that means a mutable place.  We have this distinction in LiveCode.

The expression '4 + a' can be used only as a value.  The expression a[3] can be used as a value or a mutable place.  That value is what is contained in that mutable place.  That mutable place is called a container in HyperCard.

We can't say 'put 7 into 4+a' but we can say 'put 7 into a[3]'.

The concept has strong HyperCard and LiveCode precedence.  We can say 'put 3 into char 2 of item 6 of a'.  A "chunk" is a container.

Allowing @ parameters to refer to containers and not just variables can create some implementation challenges, perhaps, even some documentation challenges, but it does open the door to commands that can be used to, say, capitalize the value of containers.  I would hope the conceptual challenges in use would only apply to advanced users doing weird things.  

In the simplest case, the extension would replace "variable" with "container" in the description of @.  

I come from a background in functional programming in which just about everything is a value and not a container, but I have embraced the language used in LiveCode and the ability to modify things in ways besides replacing variable values and replacing properties.  

Dar



More information about the use-livecode mailing list