[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A question on modification of a list via a function invocation

On Wed, Sep 6, 2017 at 7:01 PM, Gregory Ewing
<greg.ewing at canterbury.ac.nz> wrote:
> Chris Angelico wrote:
>> You can't do this with Python, since pointer arithmetic fundamentally
>> doesn't exist.
> Pointer arithmetic doesn't exist in Pascal either, yet
> Pascal most definitely has pointers as a distinct data
> type.
> Insisting that only pointer arithmetic counts as
> "manipulating" pointers seems a strange way of defining
> the word.

Understood. I'm withdrawing the assertion that pointer arithmetic is
essential, weakening the demand to the ability to:

1) Take the address of an object (yielding a pointer)
2) Move the pointer around as its own thing, eg pass it as a function parameter
3) Dereference the pointer, to read or write the original object

But you have to be able to prove that #2 is actually looking at the
pointer as its own entity. This has to be distinct from passing around
the object itself in some way.