Re: RE: pass by reference Karl
kbochert at ix.netcom.com wrote:
>
> In my implementation, pass-by reference is accomplished by
> the caller. That is:
>
> procedure foo (sequence x)
> x = x[2..3]
> end procedure
>
> sequence s = "test"
> foo (s)
> -- s still equals "test"
>
> foo (!!s)
> -- s now equals "es"
>
> Library routines can never do something behind your
> back.
I'm not so sure Karl. Lets say that I have a routine like this...
procedure X(object a)
if sequence(a) then
a = ConvertToNumber(a)
end if
GlobalX += a
end procedure
then I call this using your method...
s = "23"
X(!!s)
this should either crash with an assignment error (assigning an atom to seq) or
change the sequence
S to now be an atom.
However, calling it normally is quite safe...
s = "23"
X(s)
---------
Cheers,
Derek Parnell
|
Not Categorized, Please Help
|
|