Subject: Re: quest for pass-by-reference semantics in CL From: Erik Naggum <erik@naggum.net> Date: Sat, 04 May 2002 18:49:04 GMT Newsgroups: comp.lang.lisp Message-ID: <3229526943281243@naggum.net> * keke@ma.ccom (Takehiko Abe) | > > > PARAMETER PASSING IN LISP IS CALL-BY-VALUE. | > > | > > Whatever. but Harbison & Steele clearly indicates in the above | > > that call-by-value implies parameter copying. | > | > Indeed. | | That contradicts what you wrote earlier: | | > In C, pass-by-value implies that a copy is made of the value | > passed, | | Nonsense!! In C, as in Lisp, no copy is made. | | good night. Look, guys, am I the only one here with a computer science education? (Besides Matthias Blume, obviously.) I have no idea how people get so screwd up -- if I had, I would make a comet carreer in psychiatry from watching all the nutjobs on USENET for so many years -- but call by value or reference or name refers to the information passed from the caller to the callee about how the arguments (actual parameters) to a function were specified. Let me take the standard three, again: 1 Call by value -- no information is passed from the caller to the callee about the origin of the argument, only its value is available. So when the formal parameter is used, it refers to a local binding of that value. 2 Call by reference -- information is passed that makes the callee to reference the actual argument, to which the formal parameter refers, so when the formal parameter is used, it indirectly refers to the caller's binding of that value. 3 Call by name -- information is passed that makes the actual argument as it was specified in the call available to the caller, including any bindings that an expression closes over, such that using the formal argument (acts as if the system) evaluates the expression each time. This call-by-foo things is _so_ not about what the values of arguments might be. This is _only_ about how much the callee gets to know about the arguments it receives. I marvel at the lack of education or other exposure to these terms in the literature that could have produced such a horrible confusion. This is an extremely clear-cut differentiation of argument passing semantics that leaves no room for confusion. If you cannot access the _binding_ that was used as an actual argument in the callee, you do _not_ have call-by- reference semantics regardless of how much you may modify the contents of any composite object you are passed. -- In a fight against something, the fight has value, victory has none. In a fight for something, the fight is a loss, victory merely relief. 70 percent of American adults do not understand the scientific process.