Skip to main content
answer question from comments
Source Link
David Gudeman
  • 13.1k
  • 1
  • 19
  • 60

This technique is called abstraction in computer science. We say that the programming language implements an abstraction on top of the hardware, and that the abstraction is a higher-level language.

You seem to be equivocating between the abstraction and the implementation. C++ references and Python objects may be implemented in terms of pointers but in terms of the language abstraction they are not pointers. Language values may be implemented by storing a representation of them in computer memory, but the computer memory itself is not part of the language abstraction (at least it is understood at the assembly-language level; C++ does support the notion of chunks of memory that other objects can be implemented in).

When someone says that Python does not have pointers, they are talking about the language abstraction. If they were talking about the implementation--how the language abstraction is realized on hardware--then this would be surprising (not impossible, though). But as far as that goes, even pointers are an abstraction. At the level of assembly language, there are only integers which can be used to index into RAM. But even that is an abstraction. At the machine architecture level, there are only bits laid out in arrays that can be interpreted as integers. But even that is an abstraction. At the logic level there are only gates and other logic circuits. But even that is an abstraction. At the electronics level, there are only transistors and other circuit elements. But even that is an abstraction...

As you can see, pointers are not fundamental part of programming. They are just a convenient abstractions used in some programming languages for some purposes. If a language abstraction doesn't have pointers, then there is probably no value to trying to look under the hood to see pointers underneath.

ADDENDUM: In discussion you cite, Marko seems to be using the word "pointer" when he should be using the word "reference" and this is causing confusion; the two people are talking past each other. A pointer is a first-class language object; a reference is not. A first-class object is something that you can do the usual things on just like integers and strings. There are operators that can be used on them (in non-C languages, you can at least dereference a pointer), you can pass them to functions, and return them from functions just like any other value. There is no dereference operation in Python and although you can describe what Python does as passing and returning references, it doesn't pass and return references in the same sense as it passes and returns integers and strings.

This technique is called abstraction in computer science. We say that the programming language implements an abstraction on top of the hardware, and that the abstraction is a higher-level language.

You seem to be equivocating between the abstraction and the implementation. C++ references and Python objects may be implemented in terms of pointers but in terms of the language abstraction they are not pointers. Language values may be implemented by storing a representation of them in computer memory, but the computer memory itself is not part of the language abstraction (at least it is understood at the assembly-language level; C++ does support the notion of chunks of memory that other objects can be implemented in).

When someone says that Python does not have pointers, they are talking about the language abstraction. If they were talking about the implementation--how the language abstraction is realized on hardware--then this would be surprising (not impossible, though). But as far as that goes, even pointers are an abstraction. At the level of assembly language, there are only integers which can be used to index into RAM. But even that is an abstraction. At the machine architecture level, there are only bits laid out in arrays that can be interpreted as integers. But even that is an abstraction. At the logic level there are only gates and other logic circuits. But even that is an abstraction. At the electronics level, there are only transistors and other circuit elements. But even that is an abstraction...

As you can see, pointers are not fundamental part of programming. They are just a convenient abstractions used in some programming languages for some purposes. If a language abstraction doesn't have pointers, then there is probably no value to trying to look under the hood to see pointers underneath.

This technique is called abstraction in computer science. We say that the programming language implements an abstraction on top of the hardware, and that the abstraction is a higher-level language.

You seem to be equivocating between the abstraction and the implementation. C++ references and Python objects may be implemented in terms of pointers but in terms of the language abstraction they are not pointers. Language values may be implemented by storing a representation of them in computer memory, but the computer memory itself is not part of the language abstraction (at least it is understood at the assembly-language level; C++ does support the notion of chunks of memory that other objects can be implemented in).

When someone says that Python does not have pointers, they are talking about the language abstraction. If they were talking about the implementation--how the language abstraction is realized on hardware--then this would be surprising (not impossible, though). But as far as that goes, even pointers are an abstraction. At the level of assembly language, there are only integers which can be used to index into RAM. But even that is an abstraction. At the machine architecture level, there are only bits laid out in arrays that can be interpreted as integers. But even that is an abstraction. At the logic level there are only gates and other logic circuits. But even that is an abstraction. At the electronics level, there are only transistors and other circuit elements. But even that is an abstraction...

As you can see, pointers are not fundamental part of programming. They are just a convenient abstractions used in some programming languages for some purposes. If a language abstraction doesn't have pointers, then there is probably no value to trying to look under the hood to see pointers underneath.

ADDENDUM: In discussion you cite, Marko seems to be using the word "pointer" when he should be using the word "reference" and this is causing confusion; the two people are talking past each other. A pointer is a first-class language object; a reference is not. A first-class object is something that you can do the usual things on just like integers and strings. There are operators that can be used on them (in non-C languages, you can at least dereference a pointer), you can pass them to functions, and return them from functions just like any other value. There is no dereference operation in Python and although you can describe what Python does as passing and returning references, it doesn't pass and return references in the same sense as it passes and returns integers and strings.

Source Link
David Gudeman
  • 13.1k
  • 1
  • 19
  • 60

This technique is called abstraction in computer science. We say that the programming language implements an abstraction on top of the hardware, and that the abstraction is a higher-level language.

You seem to be equivocating between the abstraction and the implementation. C++ references and Python objects may be implemented in terms of pointers but in terms of the language abstraction they are not pointers. Language values may be implemented by storing a representation of them in computer memory, but the computer memory itself is not part of the language abstraction (at least it is understood at the assembly-language level; C++ does support the notion of chunks of memory that other objects can be implemented in).

When someone says that Python does not have pointers, they are talking about the language abstraction. If they were talking about the implementation--how the language abstraction is realized on hardware--then this would be surprising (not impossible, though). But as far as that goes, even pointers are an abstraction. At the level of assembly language, there are only integers which can be used to index into RAM. But even that is an abstraction. At the machine architecture level, there are only bits laid out in arrays that can be interpreted as integers. But even that is an abstraction. At the logic level there are only gates and other logic circuits. But even that is an abstraction. At the electronics level, there are only transistors and other circuit elements. But even that is an abstraction...

As you can see, pointers are not fundamental part of programming. They are just a convenient abstractions used in some programming languages for some purposes. If a language abstraction doesn't have pointers, then there is probably no value to trying to look under the hood to see pointers underneath.