Re: copy & set statments
Re: copy & set statments
- Subject: Re: copy & set statments
- From: Nigel Garvey <email@hidden>
- Date: Mon, 22 Oct 2001 14:17:47 +0100
Nigel Garvey wrote on Sun, 21 Oct 2001 15:54:21 +0100:
>
This is something to remember when passing a list or a record as a
>
parameter to a handler. The local variable inside the handler is a local
>
copy of the pointer to the original structure, not a local copy of the
>
structure itself. If you want to fool around with the structure's innards
>
and still have the original intact when the handler returns, use the
>
'copy' comand first:
>
>
on myHandler(myList)
>
>
-- Reassign the variable to a local copy of the list
>
copy myList to myList
>
>
-- etc.
>
>
end myHandler
I've been thinking about "local copy of the list" since posting this. It
is of course possible to pass a "local" list out of a handler as a return
value, which can be used outside the handler. Presumably, what's returned
is just a copy of the pointer, so the list itself can't actually be
considered to be "local". The description only applies to the variable
used inside the handler.
NG