Re: What other languages use the same data model as Python?

On Wed, 04 May 2011 16:22:42 -0600, Ian Kelly wrote:

However, I hope we can all agree that pass-by-pointer shares certain
features with both pass-by-value and pass-by-reference, and there are
perfectly reasonable arguments for lumping it in either category, yes?


Please don't invent another "pass by foo" term!!!!

Seriously though, "pass by foo" refers to what the compiler or
interpreter does when you, the coder, call a function with some variable,
say, x:


It is not referring to what you, the coder, does when you want to pass an
indirect reference of some sort to a chunk of data to some function. In
many languages, you would use a pointer, and write the function call
something like this:


(using Pascal's up-arrow notation for "pointer to").

Such "pass by pointer" is a tactic used by the coder, as opposed to a
language feature.

I believe this distinction between what the compiler does, and what the
coder does, is at the heart of much confusion. Pointers that are passed
as arguments are themselves data, just as much as ints or floats, or (in
languages that have first-class functions) functions.


Relevant Pages

  • Re: Non-constant constant strings
    ... simply restart your debugger session and begin again. ... if (!foo) { ... instruction pointer to the test, ... data being tested is no longer valid, etc., requiring a restart. ...
  • Re: Why is the pointer passed into the function still NULL?
    ... you must pass a *pointer* to the thing you want to modify. ... void foo (int x) ... The expression x in foo and the expression a in bar refer to ...
  • Re: Trap rvalues
    ... representation and is read by an lvalue expression that does not have ... pointers, both are pointers to the same object (including a pointer to ... pointers to one past the last element of the same array object, ...
  • Re: Static _Bool initialization
    ... The "&" operator will never yield a null pointer if its operand is ... If foo is an array of more than 42 elements, ... If the compiler (which can ...
  • Re: whats a callback?
    ... Rene may have ... 'foo' needs to be written now, which has to call another function ... 'bar' that may not exist yet. ... So you declare the interface signature of 'bar', and make a pointer to ...