Chris Angelico wrote:
This is another proof that you can't divide everything into "pass by value" vs "pass by reference"
True, but that doesn't mean you should deny that something is pass-by-value when it actually is.
In C, a string is not an entity; it's simply an array of characters. Arrays are never passed by value;
I think it's more accurate to say that arrays are never passed at all in C. A better name for pass-by-value would be "pass-by-assignment". Passing a parameter by value is equivalent to assigning it to a local name.
yet everything in C is passed by value. So you pass a pointer... by value.
Yes, because that's what happens when you assign an array in C. If it seems screwy, it's because assignment is screwy in C, not parameter passing.
What would you define LISP's semantics as? Pass by value? Pass by reference? Pass by name? Pass by immutability? Pass the salt?
Let's see... the expression being passed gets evaluated once at the point of call, and the result gets bound to a local name. Looks exactly like pass-by-value to me.
unless you mess around with "passing a reference by value" or other shenanigans.
What on earth are you talking about? I didn't even use the words "value" or "reference" in the previous paragraph. -- Greg -- https://mail.python.org/mailman/listinfo/python-list