Parameter passing
I'm sorry to do this but the examples I have seen are confusing to me. What is the difference between call by name parameter passing, and call by value? It would be great if someone could give me a Java example and explain to me how it would be different if call by name was used instead?
Thanks a lot in advance.
[327 byte] By [
abu5ea] at [2007-11-27 5:19:08]

Sorry yeah there's another way to refer to it - pass instead of call. I know java always uses pass-by-value (and uses pass-by-reference-value to allow objects to be manipulated in a similar way to reference passing.) I understand all of the above, I just don't understand what pass-by-name is. I have search Google and read several definitions, I also have a book in front of me but I just can't seem to grasp pass-by-name parameter passing.
abu5ea at 2007-7-12 10:42:27 >

> I know java always uses pass-by-value (and uses pass-by-reference-value to
> allow objects to be manipulated in a similar way to reference passing.)
"Pass-by-reference-value"? Never heard of it. Java has only one parameter passing semantics: pass by value. That might have been what you were trying to say, but using terms like "pass by <fill in with whatever you want>" encourages make believe.
"Call by name" has an entry in Wikipedia here: http://en.wikipedia.org/wiki/Call_by_name#Call_by_name According to that entry, "the arguments to functions are not evaluated at all — rather, function arguments are substituted directly into the function body"
Wikipedia gives a couple of examples (both from ALGOL 60). No Java example is possible.