Liste des Groupes | Revenir à cl c |
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:[...]
I honestly do not understand the argument you're making in favor of>
"call by" over "pass by". ("Hoi polloi"? Seriously?)
>
Procedures and functions are "called", yes? They're not "passed",
except perhaps as an argument to another procedure or function.
>
Arguments to procedures and functions are "passed", yes? Would it
make sense to say that an argument is "called"? (I note that the
Algol 60 report never refers to parameters being "called" other than
in the phrases "call by value" and "call by name".)
>
If you think that "calling an argument" or "calling a parameter"
makes sense, perhaps that's the root of the disagreement. Do you?
>
In most languages that supports by both by-value and by-reference
mechanisms, a single call can have one by-value argument and one
by-reference argument, or any other combination. Using C++ as a
convenient example:
>
void func(int by_value, int& by_reference) { /* ... */ }
int x, y;
func(x, y);
>
In the third line, there is just one call, but two arguments,
corresponding to two parameters. It's not the call that's by-value
or by-reference, it's each argument that's *passed* (using the
mechanism specified on the parameter).
>
Other than historical precedent from Algol and friends, why do you
think it's better to use "call by value" and "call by reference"
rather than "pass by value" and "pass by reference", when the
mechanism applies individually to each argument, not to the call as
a whole?
>
Do you object to using the word "pass" (without "by ...") to refer
to the arguments to a function? If not, why do you object to "pass
by ..." to refer to the mechanism?
After reading your message I spent several hours thinking about how
to answer before starting to write a reply. I ask that you take a
commensurate amount of time considering my comments before composing
any followup.
I think it's fair to say we are looking at this question from
different perspectives. I see where you're coming from; I get
why you're saying what you say. For the other direction my guess
is that my perspective either isn't apparent or isn't one that
makes sense to you. Let me see if I can shed some light on that.
The "call by" in Algol 60 is used to characterize /parameters/ of
a function definition. It's important that "call" is used in the
active voice; parameters are not "called".
Saying "pass by" sort of works okay for parameters that are
by-value or by-reference. It doesn't work as well for "by name"
parameters (certainly it is not a name that is being passed), and
really falls down for call by value-result, let alone what happens
with call by unification. Parameters are call-by because they can
affect how the function is called, both going in and going out.
Call-by shows an abstract semantics perspective rather than an
implementation perspective, and because of that applies more
universally than pass-by, which doesn't make sense outside of
a certain limited procedural context.
I guess I'll stop here. I've made a fairly substantial effort to
convey my perspective, but I'm not sure the effort will succeed.
So let me ask this: how would you describe my perspective, and
how would you say it's different from yours? Or has reading my
explanation allowed you to view the question from a different
perspective?
Les messages affichés proviennent d'usenet.