passing by refference

Donn Cave donn at drizzle.com
Fri May 16 01:32:47 EDT 2003


Quoth Doug Quale <quale1 at charter.net>:
| "Donn Cave" <donn at u.washington.edu> writes:
[... re quote from CLU document ...]

|> What does ``the value of a constant object cannot be modified'' mean?
|> Is it possible that by "value", the author means the computer data
|> represented by the object?
|
| It means there are no operations that can modify the object.  The
| object would be modified if any of its observable behavior were
| changed.  You could have a language with modifiable integer objects,
| for instance, but programming with them would be unecessarily
| difficult.  In most languages all scalar values are immutable.  (This
| wasn't the case in Fortran where call-by-reference allowed changing
| constants with usually undesired effects.)  Scalar values are usually
| not precisely defined but the basic idea is that the value can't be
| decomposed into smaller parts.  Often the scalar values in a language
| are simply listed.

Could I draw your attention to your use of the word "value" here?
"Scalar values", "observable behavior", etc.

|> | This is a description of call-by-value using CLU values (object
|> | references).  Note that CLU values used in variable assignment and the
|> | binding done by argument passing are the same.  This is the key point.
|> 
|> Does this key point require that we always expect "value" in the
|> context of CLU to mean "object reference"?  Or would you agree that
|> this would actually be absurd, except in the context of "call-by-value"
|> where we know it must have that meaning because Python passes object
|> references, Python is like Scheme and Scheme is call-by-value?
|
| No.  Value here means r-value.  These are the values used on the right
| side of assignments or bindings.  The concept of l-values and r-values
| makes sense for any programming language that has assignment or
| binding.  Curiously, there are languages that have neither. For
| example John Backus' FP doesn't even have variables.
|
| I don't think I understand what people think Python values are.  If E
| is some Python expression, does it have a different value in a
| function call
|
| def f(x):
|     ...
|
| f(E)
|
| than it does in an assignment (binding)
|
| x = E
|
| ?

I think people think Python values are the kind of value you were
talking about above, in your account of immutable constants.  A
value is the behavior of string-ness or whatever.  The language
has a mechanism by which it deploys these values, object reference,
but the mechanism is not the value.

	Donn Cave, donn at drizzle.com




More information about the Python-list mailing list