Comment by xlii

1 day ago

After spending some time in lower level languages Go IMO makes much more sense. Your example:

First one - you have an address to a struct, you pass it, all good.

Second case: you set address of struct to "nil". What is nil? It's an address like anything else. Maybe it's 0x000000 or something else. At this point from memory perspective it exists, but OS will prevent you from touching anything that NULL pointer allows you to touch.

Because you don't touch ANYTHING nothing fails. It's like a deadly poison in a box you don't open.

Third example id the same as second one. You have a IMessage but it points to NULL (instead NULL pointing to deadly poison).

And in fourth, you finally open the box.

Is it magic knowledge? I don't think so, but I'm also not surprised about how you can modify data through slice passing.

IMO the biggest Go shortcoming is selling itself as a high level language, while it touches more bare metal that people are used to touch.