Live data from Hacker News

Learn Go in five minutes

gist.github.com

21–30 of 137 posts

Re: Learn Go in five minutes

#24
Learn linear algebra ... in just 5mins!

Learn the lambda calculus ... in just 5mins!

Learn how to write a novel ... in just 5mins!

Learn how to be a stand up comedian ... in just 5mins!

Learn kung fu ... in just 5mins!

Learn how to be a world class lover in bed (or out!) ... in just 5mins!

Man, that was the best half-hour I've ever spent in my life. Sorry, I couldn't fit in Go, though.

Re: Learn Go in five minutes

#25
post #3

Good stuff. There is another >5 minute tutorial here: https://learnxinyminutes.com/docs/go/ This website has something similar for nearly every language: https://learnxinyminutes.com

I love this website! I use it every time I find a new language to get a basic understanding of it. It's an incredibly valuable resource.

Re: Learn Go in five minutes

#26

Go can be understood as an improved C that keeps much of C's simplicity but adds small, powerful features like interfaces and channels and garbage collection Go fixes C's well-understood flaws (declaration resembling use, unintuitive operator precedence, unrestricted address math, silent casting, zero-terminated strings, etc.) Go puts essential C idioms directly into the language (pointer/length is formalized as slic…

I'm not a C fan but isn't Zig much closer to C's philosophy while fixing bad parts than Go? Especially due to the garbage collection, at which point Go suddenly competes with many more simple languages.

It depends on your definition of "C's philosophy", no sarcasm, and no implied preference by me for any particular definition, as I believe many have merit. Language philosophies evolve, and C, being so many decades old, has evolved a lot. The original philosophy is probably little more than a seed crystal at this point for the several philosophies that have been loaded on to it over the years.

It is probably reasonable to say that Zig is closer to C's current philosophy in practice, which encompasses many additional developments over the decades to deal with various aspects of C and programming real machines that have arisen as both have changes, and Go closer to C's original philosophy of simplicity and relative ease of use. (In modern times, C is not one of the easier languages to use any more, due to significant advancements in the field of making easy-to-use languages. But it was originally intended to be an advancement there itself.)

By similar logic, I can say with a straight face that all of Go, C++, Zig, Rust, and Swift (and more) are "evolutions in general-purpose programming languages like C", despite their wild differences, because the world has gotten larger, and there is room for a lot of variations like that, each addressing different aspects of the newer, larger world.

Re: Learn Go in five minutes

#28

Is this a response to that "learn rust in half an hour?" ;) https://fasterthanli.me/articles/a-half-hour-to-learn-rust

Someone make "Learn Haskell in 50 seconds"

    [Ancient Aliens Guy Picture Here]

               FUNCTIONS
I've gotten it down to about two seconds here....

Re: Learn Go in five minutes

#29
post #5

Go can be understood as an improved C that keeps much of C's simplicity but adds small, powerful features like interfaces and channels and garbage collection Go fixes C's well-understood flaws (declaration resembling use, unintuitive operator precedence, unrestricted address math, silent casting, zero-terminated strings, etc.) Go puts essential C idioms directly into the language (pointer/length is formalized as slic…

I like C but strongly dislike Go. They share nothing other than having a small(ish) feature set.

Take Go's slices, for example

Realize a Go []int ("slice of int") is just a C struct like this, passed by value:

  struct intSlice {
      int* addr;
      int len;
      int cap;
  };
The memory at addr is not owned by the slice. All the slice operations are simply notation for manipulating the struct. Go's garbage collection makes the whole thing work well

This can be confusing if you're used to C++'s std::vector (which owns the memory) or Python's slices. Go's slices are a shallow pointer/length system exactly like is used in C all the time. For example:

  void sort(int* addr, int len);
becomes

  func sort(a []int)
A Go slice is just a formalization of C's pointer/length idiom, with terse notation for manipulation

Re: Learn Go in five minutes

#30
post #12

This is neat, and a testament to the simplicity of Go. I normally point people to this tutorial if they want to learn Go quickly, it is interactive (able to navigate straight to go playground) and very well done in my opinion. https://gobyexample.com/

> the simplicity of Go

As someone who's not written any Go, I found fasterthanlime's critique of the language[0] damning enough that I likely won't ever touch the thing. Maybe he's cherry-picked examples, but his article was thorough and technical enough to convince me that the Go mantra of simplicity is just surface-level.

[0] https://fasterthanli.me/articles/i-want-off-mr-golangs-wild-...

Post reply on HN