Subject: Re: quest for pass-by-reference semantics in CL From: Erik Naggum <erik@naggum.net> Date: Thu, 02 May 2002 16:51:17 GMT Newsgroups: comp.lang.lisp Message-ID: <3229347076995853@naggum.net> * Frode Vatvedt Fjeld <frodef@acm.org> | Aren't you just redefining the meaning of pass-by-value here? Is there | any system that isn't pass-by-value under your definition? Look, this is getting annoying. The reference that is intended in the term pass-by-reference is not the value of the variable (storage cell), it is the variable (storage cell) itself. This has been the established meaning of these terms basically forever. You are seriously confused if you think pointers as such constitute references. There are three very, very common ways to pass arguments to functions: 1 Pass by value: The value of the variable (storage cell) is extracted by the caller and passed to the callee. This also means that all arguments to a function are just values and a function call can just evaluate all arguments in order and pass the values to the callee. This is precisely what Common Lisp specifies. 2 Pass by reference: The variable (storage cell) is passed to the callee, which can read or write to it. This means that you cannot call a function with the value of another function call without storing it in a variable. Fortran has _traditionally_ been pass-by-reference. Ada has out parameters. C++ has references (coincidence? not!). 3 Pass by name: The expression itself is passed to the callee, which will re-evaluate it with the values of subexpressions captured in the call. (They actually pass closures much like I and Joe and Pierre offered with the setter/reference macro.) This is what Algol and Simula can do. This is (or should have been) CS 101 material. Please just learn it and avoid confusing others who might have no education at all and are likely to listen to bogosities. Having to clean up after such confusions is both annoying and wasteful when you could have avoided the "information pollution" in the first place. -- 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.