4 ms·
Small design details I like in Go
- andreareina 7y ago> Go supports using `aValue.Method` as a function value without losing the `aValue` context. This is a so natural feature but I find that no other popular languages support it (or support it well)[1]. Python (adapted from example at [1]): class C: def __init__(self, name): self.name = name def m(self): print(self.name) def g(f): f() g(C("foo").m) // foo I like posts that showcase what particular languages do well, and they'd really read better without using other languages as a foil/invoking the Blub paradox[2] (or if they did, show some understanding of why said language behaves the way it does[3]) [1] https://github.com/go101/go101/wiki/The-main-sell-point-of-Go-is-not-simplicity%2C-but-overall-balance-and-flexibility https://github.com/go101/go101/wiki/The-main-sell-point-of-G... [2] http://www.paulgraham.com/avg.html http://www.paulgraham.com/avg.html [3] https://en.wikipedia.org/wiki/Wikipedia:Chesterton%27s_fence https://en.wikipedia.org/wiki/Wikipedia:Chesterton%27s_fence
- tapirl 7y agoGlad to know Python also does it well, but the wiki page doesn't mention python at all. ;) > without using other languages as a foil/invoking the Blub paradox That page just shows some facts. The said language really behave as the way the page describes. No intention to foil any language.
- andreareina 7y agoTFA, second sentence: "no other popular languages support it (or support it well)". If there's no intention to use other languages as a comparison, maybe it shouldn't use other languages as a comparison?