Liste des Groupes | Revenir à l c |
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:Kaz Kylheku <643-408-1753@kylheku.com> writes:>On 2024-07-12, bart <bc@freeuk.com> wrote:>It's clearly not by value. It's apparently not by reference. You>
can't get away with saying they are not passed, as clearly
functions *can* access array data via parameters.
Actually, you probably can get away with saying that it is "passed
by reference".
>
The formal term that doesn't apply is "call by reference"; that's
what C doesn't have.
>
"call by reference" emphasizes that the function call mechanism
provides the reference semantics for a formal parameter, not that
some arbitrary means of passage of the data has reference
semantics.
[...]
>
I know that "call by reference" is the usual formal term, but I
personally prefer "pass by reference".
>
The terms "call by reference" and "call by value" emphasize the
call, implying that all arguments in a given call are passed with
the same mechanism. In some languages that's true (C argument
passing is purely by value, and Fortran, as I understand it, is
purely by reference), but in others (C++, Pascal, Ada) you can
select by-value or by-reference for each parameter. "Pass by
(reference|value)" feels more precise.
>
I haven't checked, but I suspect the terms "call by (reference|value)"
predate languages that allowed the mechanism to be specified for each
parameter.
I suspect that your guess here is influenced more by what you would
like to be true than what is likely to be true.
What is likely to be true is that these terms entered the language
at essentially the same time as the original Algol. Algol 60 has
both call by name and call by value, referred to by those names in
the Algol 60 Report, and selectable on a per-parameter basis.
>
By contrast the precursor to Algol 60, the International Algebraic
Language or IAL for short (and referred to after the fact as Algol
58) did not use either term, and described the coupling between
arguments and parameters only in somewhat vague English prose that
left unclear exactly what the binding mechanism(s) were to be.
(There was a description for functions and a separate description
for procedures, not quite the same, and both not completely clear
exactly what the mechanism was meant to be.)
>
Thus it seems likely that the terms call by name, call by value,
and perhaps other similar terms, first arose during the discussions
of the Algol 60 working group in the late 1950s, and entered the
general lexicon with or perhaps slightly before the publication of
the Algol 60 Report, which describes and allows both call by name
and call by value, selectable on a per-parameter base, and referred
to by those names in the published Algol 60 Report.
Les messages affichés proviennent d'usenet.