5 ms·
pointer is an implementation detail. No one should have to learned that first.
by wiz21c 6y ago
pointer is an implementation detail. No one should have to learned that first.
- canadianfella 6y agoHow is it possible to miss sarcasm like this?
- tpush 6y agoA pointer (or reference, or just 'address') is a general concept that by definition is part of any language featuring mutation. Any language that makes use of mutation for primitive constructs (not saying that's the case here specifically) needs an understanding of "observing/causing change" pretty early on.
- improbable22 6y ago> is a general concept that by definition is part of any language featuring mutation. One counter-example is Mathematica. I can mutate any object any time I like, and doing so is extremely common. Yet under "pointer" its help tells me about some unicode symbols, and some GUI stuff about mouse pointers. In reality, some of its lists are dense memory like C, some contain arbitrary objects (such as expressions, or high-precision numbers), but these implementation details aren't part of the language, and most users never know them.
- tpush 6y agoThe specific word or implementation isn't important. In Mathematica's case (and most other languages, sadly), presumably the concept of 'variable' is overloaded with the semantics of a pointer/reference. Meaning, you cause and observe changes to locations via a variable.
- tremon 6y agoMathematica is also not a low-level programming language. It's math-based, so it deals with abstract concepts, not concrete hardware implementations. 0-based arrays are based on hardware implementations; 1-based arrays are based on abstract collections; you could make the argument that 0-based arrays are a leaky abstraction, but the question then becomes: what abstraction? C explicitly tried not to abstract away the underlying hardware.
- improbable22 6y agoIf "any language" means "any language sufficiently low-level to have C-like pointers", then no contest! Surely the point of any language at all is to abstract away some details of the underlying hardware. Both for portability and to make things easier for human brains. How much you should abstract away obviously varies, based on what you're trying to do, and on how varied the hardware is. And it depends on how much computation & memory you can give your compiler. One reason new languages can have nicer abstractions is that they don't have to compile on 1970s hardware.
- zajio1am 6y ago0-based arrays/indexes are also based on abstract concepts. 1-based ordinal numbers (in both maths and language) are just tradition from time before 0 was generally accepted. Set theory (as a clean design of math foundations) also starts ordinals at 0.
- tomp 6y agoTrying to program without understanding how data is stored in memory is like trying to cook without understanding how heat affects food.
- AnIdiotOnTheNet 6y agoThat depends entirely on the kind of programming you're trying to do. For beginners working in high level languages it is an implementation detail they need not be concerned about. Growing up with BASIC, I didn't have any understanding of pointers or how memory worked. PEEK and POKE, which I only saw used in other people's programs and examples, were black magic as far as I could tell. It wasn't until I learned C that I actually understood them but I still managed to write a whole lot of programs without ever using them. To be a professional programmer I'd agree though. If you don't understand how pointers work, regardless of the language you're using, you're probably not good at your job.
- stabbles 6y agoLisp programmers don't care how heat affects food since the 1950s.
- RaptorJ 6y agoThis is an unfortunate analogy given how complicated and poorly understood the heat-affects-food chemical reactions are. And yet food gets cooked.
- gct 6y agoa pointer is an array index