Hacker News new | ask | show | jobs
by pansa2 701 days ago
> It is an explicit goal of the go team to minimize the number of keywords in the language.

It's understandable - because unfortunately people judge languages by very shallow metrics. Several times I've seen people use "number of keywords" as a proxy for language complexity.

However, that's completely misguided. `static` in C++ (and, IMO, `for` in Go) demonstrate that overloading a keyword to mean multiple things is harder to understand than having a larger number of more meaningful keywords.

2 comments

I (still) find it confusing that in C++ the symbols to declare a pointer and a reference are the same as the ones for dereference and address-of.

That pointers declared with * in Go are more like references (&) and that there are no true pointers (I think) does not really help.

Go has true pointers.

If you mean pointers arithmetic, that can be achieved with unsafe package.

From my vantage, pointers without arithmetic are typically called references, as opposed to "true" pointers. I did not mean it in a derogatory way, both have their place and Go is a great language even (or maybe despite) without what I would call "true" pointers.
From CS point of view, references are pointers that you can't get the underlying value behind them.

Being able to do arithmetic is orthogonal to that.

In fact check a language like D, C#, Swift, with references, pointers, and pointers with arithmetic.

The fact that, in Go, you can have pointers to pointers, and reassign pointer variables like any other, would imply, IMO, that pointers are first-class values, and so they are true pointers, even without being able to pointer arithmetic with them.
how is for overloaded? in other languages you can just do for (;;) { which is the same; while is a redundant keyword