Re:Understand Go pointers
by mikeash on Wednesday April 26, 2017 @09:23AM
(#14202702)
Did you never go through the beginning phase where you didn't understand pointers? That's usually a breakthrough moment, not something you start out with.
[ Parent
| on HN ]
No, because the languages I had available to me were Timex 2068 Basic and Z80 Assembly.
Maybe the first couple of hours when I still hadn't read the DIM, DATA, READ, POKE and PEEK manual pages.
Just like on Dave Cheney's post, seeing a few box examples was enough to get it.
So you benefitted from exactly the sort of explanation you now seem to be questioning?
No, because I never had a "breakthrough moment".
It just felt natural on how a computer was working, typing example after example, to a 10 year old version of myself.
There's a certain distinction to be had between understanding memory addresses, and understanding pointers as part of a type system. I remember the former was very straightforward in various BASIC dialects running on DOS, and it never really confused me. C pointer types, on the other hand, did. Sure, there's an obvious mapping between the two... in the retrospect. But it wasn't obvious at first.
Depends where you start from, really. If you come from the "bare metal" side of things (electronic work, microcontrollers etc...) then work your way "up" then the memory model is all you think about. I learned pretty much that way so I never really had much of an issue understanding these concepts (conversely, it took me a while to get used to things like dynamic typing).
That being said nowadays I'm sure many more coders start with something like Javascript instead of 8bit controllers, so I'm sure these types of articles are very valuable to many.
Sure. I'm not questioning the need for pointers to be explained.
I'm just surprised that an explanation geared for programmers would need to also explain that variables are stored in local memory, or what RAM is. (Again, there is nothing wrong with explaining that.)
You can get pretty far without knowing that. A big chunk of Go's audience seems to be Python programmers who want something that isn't quite so slow, and you can probably do a whole career in Python without ever knowing what a pointer is.
Re:Understand Go pointers
by JustSomeNobody on Wednesday April 26, 2017 @10:50AM
(#14203423)
I'm so glad I learned how to program on a C=64. Even using Commodore BASIC one was introduced to how memory worked so that one could use PEEK and POKE commands. This made learning C and pointers so much easier because the mental model was there already.