News for hackers. Stuff that matters.

eraxley

Re:Clear is better than clever [pdf] on Monday May 06, 2019 @07:27AM (#19838398)
You are right that (2) needs to be dereferenced first, however, in go a pointer is autmatically dereferenced when accessing its properties or "methods". What I mean by this is that if you want to access a property on thing, it would look the same.

In C++ it would look like this:

  (1) x = thing.Property;
  (2) x = thing->Property; (or (*thing).Property)
but in go, both would look the same, like this:

  (1) x = thing.Property
  (2) x = thing.Property
So there is a difference syntactically, and the compiler will handle them differently, but whether the difference is semantically relevant is debatable.