Live data from Hacker News

Learn Go: Hand-crafted Go exercises and examples

github.com

1–10 of 68 posts

Re: Learn Go: Hand-crafted Go exercises and examples

#4
Observation: I see that you do 26 exercises before doing anything with pointers.

I often wonder if one of the reasons Go is more "simple" or approachable to some is because you can, to a large extent, ignore pointers and interfaces and "just write that weird little * or & in some places" and get away with it. Whereas, I believe in other languages, this is much less possible (e.g. in Java or Rust you need to learn about less "just logic" traits of the language earlier on (class inheritance, generics or Options, borrow checking, etc.)

I'm not saying the above is a good thing, but I often wonder if there aren't ways to make this more of an incremental learning curve in other languages in a similar way that you can largely ignore pointers in Go for a long time and be productive without understanding them. What would a similar incremental learning curve for generics be?

Re: Learn Go: Hand-crafted Go exercises and examples

#6
post #4

Observation: I see that you do 26 exercises before doing anything with pointers. I often wonder if one of the reasons Go is more "simple" or approachable to some is because you can, to a large extent, ignore pointers and interfaces and "just write that weird little * or & in some places" and get away with it. Whereas, I believe in other languages, this is much less possible (e.g. in Java or Rust you need to learn abo…

Your can't really do anything real without pointers in Go though because you won't be able to mutate states out of a function.

Re: Learn Go: Hand-crafted Go exercises and examples

#7
post #4

Observation: I see that you do 26 exercises before doing anything with pointers. I often wonder if one of the reasons Go is more "simple" or approachable to some is because you can, to a large extent, ignore pointers and interfaces and "just write that weird little * or & in some places" and get away with it. Whereas, I believe in other languages, this is much less possible (e.g. in Java or Rust you need to learn abo…

Your can't really do anything real without pointers in Go though because you won't be able to mutate states out of a function.

That's definitely true, but I've often seen beginners just say:

    type Foo struct { ... }
    func (f *Foo) Bar() { ... }
And go "Aha, that's an object and a method, I get it!" but when asked whether they should be using a pointer there or not, have no idea what that even entails.

In other words, it's possible to neglect the details of pointers easily and have things generally work

Re: Learn Go: Hand-crafted Go exercises and examples

#8
post #7

Earlier quoted context omitted.

Your can't really do anything real without pointers in Go though because you won't be able to mutate states out of a function.

That's definitely true, but I've often seen beginners just say: type Foo struct { ... } func (f *Foo) Bar() { ... } And go "Aha, that's an object and a method, I get it!" but when asked whether they should be using a pointer there or not, have no idea what that even entails. In other words, it's possible to neglect the details of pointers easily and have things generally work

Remember ByVal and ByRef from VB? (I hope you don't, it was the dark ages) but those to terms I've found are very useful for getting folk introduced to pointer - and also why.
Post reply on HN