top | item 40608764

(no title)

bojanz | 1 year ago

In retrospective, I think it's obvious that Go's decision to have package and variable names be in the same namespace was a mistake. It is the main reason why people overuse single letter variable names, and have debates such as the one in the linked post.

I am guessing that using a different operator (e.g. rate::NewLimiter()) was deemed inelegant, but it would have avoided a whole set of problems.

discuss

order

karmakaze|1 year ago

retrospective? It was one of the first silly gotchas I hit picking up the language. And the stdlib authors chose those package names!

It's funny how when I was using Go, I couldn't wait until it got generics (which was only a matter of time despite the party line). When it finally got them, I was versed enough in the edges and nature of the language/ecosystem that I didn't really care anymore and moved on. I am glad that Go rose to popularity because it brought to light opinions that weren't all that popular: memory layouts matter and error values (rather than exceptions). I still prefer a sound type system over nil/zero values though.

corytheboyd|1 year ago

Totally agree, it’s a bit of a strange design choice. I’d be curious to read about the tradeoffs made here, as it must have come up while developing the language.