On Thu, Jun 6, 2019 at 12:00 PM David Storrs <david.sto...@gmail.com> wrote:

> My understanding is that Racket is call by value, not call by reference.
> My application will often be passing around large-ish byte strings; will
> they be copied every time I pass them, or will the interpreter use
> copy-on-write?
>


"call-by-value" is used in two very different ways. Racket is call-by-value
in the sense that all arguments to functions need to be evaluated before
the function body is evaluated. This kind of "call-by-value" is
distinguished from other evaluation strategies, like call-by-name or
call-by-need.

The other sense of the term -- and the one you're asking about -- has to do
with whether arguments are copied from caller to callee. I find the terms
"call-by-value" and "call-by-reference" in this context to be pretty
confusing. (If the function argument in question is a mutable byte-string,
why wouldn't passing it "by-value" imply that you pass the very same
mutable byte-string, rather than making a copy of it?) At any rate, Racket
does not copy arguments on function calls (except insofar as the copy is
indistinguishable from the original -- as with a fixnum, for example).

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAKfDxxx8TxKvuASFRgNd8A205LvdEFzggG-BN7o8ocRN5pk%2BvQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to