4 ms·
None of those things are really roadblocks to Getting Shit Done though, except maybe dynamic loading. Go has plenty of support for global constant values that
by sirclueless 15y ago
None of those things are really roadblocks to Getting Shit Done though, except maybe dynamic loading.
Go has plenty of support for global constant values that take the place of enumerations, even to the point of having an "iota" syntax to make initializing constants easier.
Exceptions are generally an anti-pattern in my opinion: a hack to get around the ability to return multiple values from a function, so that error conditions can be handled in-band. The other technical challenge exceptions sometimes provide -- guaranteed cleanup after code that might fail to execute -- can be handled by Go's deferred function execution.
Generics are a powerful abstraction, but Go has very good support for (un)boxed values and interfaces, so the only thing you would get from generics is a bit more type safety. The additional complexity required to support generics isn't worth it.
Dynamic loading is arguably a blocker for certain modes of development and distribution, but by not supporting dynamic loading, Go can make tremendous simplifications in its module system. Making the assumption that every go library is distributed in source form greatly reduces compatibility friction and runtime bugs. "DLL Hell" may be a "solved" problem on most systems nowadays, but there are a lot of moving parts to enable that.
The simplifications that Go makes are 100% worth it in my opinion. There is one place where Go sacrifices something that can't be replaced is that a stop-the-world garbage collector may be unacceptable for some applications. Other than that, codebases aren't actually served by having too much power in their languages, even if an individual programmer might be.
- pjmlp 15y agoioata is a poor man's solution to enumerations. Why should I do the work for the compiler? Even C has enumerations, a language developed in 1972! This is how modern Go is. The lack of generics makes everyone that writes generic data structure code like it was the 90's again. Copy-pasting code or writing template processors to generate code. Talk about evolution. Dynamic loading is an important way to write modular applications that can be composed on run-time. Something like Eclipse would be impossible to write in Go, due to performance constrains of interprocess communication. If Go did not had Google behind it, I doubt it would be noticed, it would fail as just another language. Look how successful Limbo and Alef were. And Go is nothing more than a reinvention of them.
- dsymonds 15y agoiota is much more general than just enumerations. http://golang.org/ref/spec#Iota http://golang.org/ref/spec#Iota A neat example is using it to define constants for a bit field: const ( A = 1 << iota B C )
- pjmlp 15y agoIt pollutes the global namespace, plus it is a common enumeration feature that you can give initial values to the enumeration elements, so I fail to see iota benefit.
- 4ad 15y agoThere is no global namespace in Go. The fact that you don't know this trivial thing means you nothing about Go and only spread FUD.
- pjmlp 15y agoDon't put words in my mouth please. Each package has a global namespace, so each const has to be unique at the package level to avoid namespace collisions. With proper enumerations, only the enumeration needs to be unique, while the enumeration elements would be scoped to the enumeration level, as most (not all) languages do.
- dsymonds 15y agoYou keep using that word, "global". I do not think it means what you think it means.
- agentS 15y agoPeople who write data structures just give up type-safety when doing so. They don't copy-paste code or write template processors, afaik. A Left-leaning Red-Black Tree, for example: http://gopkgdoc.appspot.com/pkg/github.com/petar/GoLLRB/llrb http://gopkgdoc.appspot.com/pkg/github.com/petar/GoLLRB/llrb Holding up Eclipse as an example citing performance is perhaps not the best idea. And Chromium seems to do just fine (performance-wise) using IPC between renderer processes and the main process.