On Jan 27, 2006, at 5:17 PM, Kevin Toppenberg wrote:
Yes, it's a standard term. Actually, most programmers should be familiar with the terms "pass by value" and "pass by reference", but "call by name" is a little more esoteric. (BTW, I cheated a bit, the real name is the thunk, and a better name for what MUMPS does might be "pass by text"). Think about a language like C or Pascal. In C, int strange (int x) { x = x + 1; } doesn't actually do anything. The reason is that when strange is called, the value of x is pushed onto the stack. Within the invocation frame, that value is stored locally (in principle), and the local value is incremented, but once the function call returns, that variable has gone out of scope and nothing has changed. But if, instead we pass a pointer to x (i.e., a reference) then, though the pointe never changes (because C only passes arguments by value) to value stored at the location to which it points, can change. In Visual Basic (for example) there is no special syntax, but objects are always passed by reference, and so if you pass a (reference to an) object as a parameter to a function, that function can change the object. I understand your point about the dot syntax looking more like using the variable's name (but it went completely past me when I first read your message). Very few non-functional languages have call by name semantics (at least now!) One of the interesting things about MUMPS is that it does make it possible to emulate call by name, which is one thing that makes it so flexible. === Gregory Woodhouse "A perfectly rational dog placed between two equally attractive sources of food will starve to death." --Jean Buridan (14th cent. French philosopher) |
- Re: [Hardhats-members] Parameter passing by reference vs... Greg Woodhouse
- Re: [Hardhats-members] Parameter passing by referen... Kevin Toppenberg
- Re: [Hardhats-members] Parameter passing by ref... Gregory Woodhouse
