News for hackers. Stuff that matters.
Re:Understand Go pointers by jayflux on Wednesday April 26, 2017 @09:15AM (#14202648)
> What kind of programming can one do without even that level of mental model of what a computer does?

JavaScript? Python?

Re:Understand Go pointers by lultimouomo on Wednesday April 26, 2017 @12:36PM (#14204557)
I'm pretty sure to program in Javascript you need to understand that primitives are passed as values, while objects are essentially passed by pointers, and if you modify one inside the callee, the caller will see the modifications.

Understanding this fact does not strictly imply having a basic understanding of memory, but it gets pretty close to it. I would personally be weary of some who calls itself a programmer or software engineer and couldn't write this article themselves.

Re:Understand Go pointers by paulddraper on Wednesday April 26, 2017 @02:55PM (#14205882)
Primitives being passed by pointer or value....what is the difference?

The only relevant parts is that (1) they are immutable and (2) they are compared by value.

Re:Understand Go pointers by throwaway2016a on Wednesday April 26, 2017 @09:44AM (#14202841)
There is an argument to be made that is true for any of the top 10 programming languages with the exception of perhaps C and C++.
Re:Understand Go pointers by pavlov on Wednesday April 26, 2017 @09:31AM (#14202759)
Surely you need to have some kind of idea of what memory is just to write:

  var a = 1
  var b = 2
You have to know that these values are stored in working memory, not on hard drive or Google's servers or Martian stone tablets.
Re:Understand Go pointers by aninhumer on Wednesday April 26, 2017 @09:35AM (#14202778)
No? All you need to understand to program are the assignment semantics.

Understanding the implementation details is valuable, but I'm not sure why you think it's necessary to program?

Re:Understand Go pointers by pavlov on Wednesday April 26, 2017 @09:54AM (#14202930)
I just don't see what kind of useful programming you can do without knowing anything about the machine it runs on.

If "a = b + c" takes a second to execute, you have to take that into account. The programs that people wrote for 1950s computers were very different from today, even though the language semantics might be essentially the same.

On the other hand, this discussion is helping me understand why the web development world is full of weird database-backed Rube Goldberg machines that can spend milliseconds to access a few bytes of data that were already in RAM.

Re:Understand Go pointers by aninhumer on Wednesday April 26, 2017 @10:15AM (#14203120)
>If "a = b + c" takes a second to execute, you have to take that into account.

But it doesn't, so you don't.

Sure understanding performance is necessary to build more complex or higher usage systems, but not understanding it does not preclude "useful programming".

Re:Understand Go pointers by pavlov on Wednesday April 26, 2017 @10:38AM (#14203334)
>If "a = b + c" takes a second to execute, you have to take that into account.

But it doesn't, so you don't.

How do you know it doesn't? What if assigning to 'a' writes to a remote database and waits for the write to be confirmed?

More to the point, how does a new programmer know that is not the case? The average person's expectation of computation speed is shaped by the experience of using server-side web apps: you click on a button, a new page is loaded from the server taking multiple seconds to finish.

To understand that an assignment doesn't run that slow, you need to be told that. Surely explaining local memory would be part of that.

Re:Understand Go pointers by ehsanu1 on Wednesday April 26, 2017 @03:11PM (#14206028)
To understand that an assignment doesn't run that slow, you need to be told that.

Not really. You just try it, and notice it ran instantly. You don't really have to care how it happens to run behind the scenes, as long as you have a working model of the semantics. That's the entire point of most abstractions, to make it so that you don't have to think about all the details when you don't want/need to.