On Nov 12, 8:34 am, david.willi...@[EMAIL PROTECTED]
(David Williams) wrote:
> If the language is set up to call by reference, it's easy to write code
> that effectively calls by value, e.g.:
>
> CALL Twiddle (X + 0)
>
> If Twiddle changes the value of its input parameter, the value of X in
> the calling routine will *not* be changed.
>
> But how easy is it to do the other way around? If the language is set
> up to call by value, can we write simple code that effectively calls by
> reference? I can't think of an easy way to do it.
For a really interesting exercise, you should try programming using a
pure functional language like Lispkit Lisp, Scheme, or Haskell. This
forces you to use functions which only provide call-by-value
arguments. Call-by-reference isn't available. It's a very different
experience from BASIC programming. Nevertheless it's still possible to
do all the same stuff as BASIC with relatively simple code.
Cheers
Derek


|