News for hackers. Stuff that matters.
Re:The ecosystem of the Go programming language by TheDong on Monday March 22, 2021 @03:30PM (#26545594)
> Having fewer keywords does make Go simpler to learn and simpler to read other peoples code

Go carefully touts how few reserved keywords it has, but I think it would actually be a simpler to reason about language if it had more reserved keywords.

For example, you may notice that "true", "false", "len", "new", etc all aren't reserved keywords.

This sometimes does lead to bugs, for example someone may make a function, like "func memoize(new func(...interface{}) interface{}) func(...interface{}) interface{}", which shadows a common builtin function with a function argument.

Usually, the above leads to a compiler error when you try to use the "copy" argument (a value) as a function, but every once in a while, you end up with a type-compatible shadow, at which point things can really break.

It would be less confusing if things like "new", "len", "copy", and "true" were keywords, rather than builtins that someone may accidentally alias and shadow.

If you account for things like rather essential builtins as well, go's list of keywords starts to look far less impressive, and on-par with java or C#.

Re:The ecosystem of the Go programming language by colejohnson66 on Monday March 22, 2021 @05:47PM (#26547683)
Speaking of reserved words, I remember reading once about how PL/I had no reserved words. Which has the nice quirk that this is valid code:

    IF IF = THEN THEN THEN = ELSE ELSE ELSE = ENDIF ENDIF
...assuming IF, THEN, ELSE, and ENDIF are all variables.
Re:The ecosystem of the Go programming language by gher-shyu3i on Monday March 22, 2021 @04:38PM (#26546619)
true := false is valid golang code
Re:The ecosystem of the Go programming language by makapuf on Monday March 22, 2021 @05:21PM (#26547296)
Re:The ecosystem of the Go programming language by DangitBobby on Monday March 22, 2021 @11:08PM (#26550569)
Wow, WTF? Why are true/false not reserved?
Re:The ecosystem of the Go programming language by oblio on Tuesday March 23, 2021 @07:05AM (#26553554)
They were worried about internationalization and they though reserving vrai/faux, adevărat/fals, etc would be overkill.

I'm kidding. It does seem like a strange decision...