182 points · by ngaut · 8y ago · 81 comments
He also hints that it would likely only be done to address major issues/concerns/changes such as:
* generics
* modules (perhaps done? time will tell)
* errors (if err != nil {}, extra type information, chaining, etc)
* context
Still to early to tell if anything I listed or he listed would be part of "Go 2" or whatever it happens to be called.
Go project lead Russ Cox already talked about that on an episode of the Go Time podcast. Transcript: https://changelog.com/gotime/77#transcript-60
Anyway, I will miss our GOPATH overlords. I have enough decisions to make, I'm fine with the language making some for me.
The more they stall adding stuff like generics the more painful (and more work for the tools and ecosystem to catch up) will be when they eventually cave in and do it...
And there will always be all the workarounds, third party solutions, and wasted efforts that would could have been avoided if something that could have been delivered early on (like e.g. package management) didn't come a decade late for no good reason.
At least now they've come up with a module/dependency system, which, even though a decade late, doesn't bring anything extraordinary to the table compared to what other platforms already had for ages.
Generics and error management remain before it makes sense to make it stable and boring for eternity...
I would be interested to hear about use cases that couldn't be solved in this manner
It sounds like you're going to reject proposals for generics on the grounds that "you could just cast values of type `interface{}`" unless someone can show you a situation where you can't do that. The problem is that the people who want this sort of feature don't think that's even a solution.
I don't think you fully grasp the breakthrough that the theory behind Go modules is for dependency management in general. It vastly improves on and simplifies anything that existed in this domain before.
It's like saying Copernican heliocentrism didn't bring anything extraordinary to the table compared to Ptolemaic geocentrism. https://en.wikipedia.org/wiki/Copernican_Revolution#/media/F...
One of my greatest hopes is I can convince my teammates that its be worth the time investment to transition all our dependencies management ecosystems into the Minimum Version Selection algorithm.
It only seems like a revolution because the previous situation in Go was such a mess. As someone that writes a lot of both Rust and Go I’m not nearly as impressed.
I've read the specs and justification posts. I don't find it gives anything better (and in some ways it's worse) than what can be achieved with, e.g. cargo.
>It's like saying Copernican heliocentrism didn't bring anything extraordinary to the table compared to Ptolemaic geocentrism
Yeah, it's like saying that, with the only difference that we're actually talking about something that brought nothing extraordinary here (as opposed in the contrived example).
"Go 1.11 supports the upcoming OpenBSD 6.4 release. Due to changes in the OpenBSD kernel, older versions of Go will not work on OpenBSD 6.4."
This is, I assume, because Go makes direct syscalls rather than going through the C library. Many operating systems, including Windows, don't consider that a stable public interface.
So does this mean that older Go binaries will stop working when you upgrade the OS? I guess that would make the source compatibility extra important to them, since you must keep recompiling your old programs as you upgrade to newer a OS. (Perhaps it's also why they're dropping support for older OS versions so quickly?)
An example of this was the change to 64-bit time_t back in 2013 (talk: https://www.openbsd.org/papers/eurobsdcon_2013_time_t/ ), and evolving syscalls like pledge(2) that changed syntax between releases as the problems/benefits of a specific implementation choices were learned.
Windows in no way requires libc. You're right that it does require you to call their public interface dlls, but they're pretty ridiculously stable.
In particular, Godoc is absolutely effortless. No build step in your project, no cryptic documentation syntax, no need to tell the documentation generator how to link to your dependencies' documentation pages, etc. Everything just works, and the output is quite a lot cleaner than the aforementioned as well.
No doubt there's a little room for improvement in how the text is layed out and organized, but it's still leagues better than all other documentation systems I've used. With Python (sphinxdocs) in particular, everything gets rendered into a giant page with no clues about what class's `__str__()` method I'm currently looking at.
Also, i’ve never found Rust’s docs to be very easy to read; maybe the complexity of the type system makes for a more challenging UX, or maybe my opinion is simply an outlier.
In any case, it’s good to know things can get even better. Thanks for sharing!
See for example https://docs.rs/diesel/1.2.2/diesel/pg/index.html.
Godoc is too plain and almost cumbersome to read for me, while Elixir is too pretty and not so efficient in displaying the type information in my opinion.
Rust has a happy middle ground here.
The mileage does vary greatly apparently.
godoc maintainer here. We have a lot of UI improvements coming for 1.12.
- A TOC at the top
- A sidebar for easy scrolling
- More cross-links for easy navigation.
If hotlinking comes through, that's a major improvement in itself.
Stay tuned !
That is Aug 2020 or Feb 2021 for generics.
(borrowing the '@' prefix for macros from Julia)
type ConcreteStruct @macroType(int64)
val := @errReturner(file.Write(data))
and backwards compatibility is allowed by running the go2 compiler in macro-expansion-only mode that creates macro expanded Go1 compatible source.
Have a look at modern web development. Because they have no macros, they wrote a bunch of tools which "compile" different domain specific languages (DSL's) to "the real stuff". Nowadays you compile pseudo HTML, pseudo CSS and JavaScript (modern style) to HTML, CSS and JavaScript (backward compatible, a.k.a. old style JS). That's insane. On the other hand, whiteout those code-transformation tools – which are called macros if they are built into the language – all those fancy and simple web-tools would not be feasible.
Ignoring macros means to me oversimplifying programming. Which results into not solving the real (meta) problem. For a while you will get away without macros/code generation, but in the long run they are inevitable.
I prefer safe AST based macro than runtime reflection like Go has. The latter is actually a cop-out, unlike the former in the context of type safety at compile time.
"Everybody go an invent your own way to handle error checking/propagation" etc...
func Foo(x int) (int, error) { var err error a, err := whatever() if err != nil { return 0, err } b, err := whatever() if err != nil { return 0, err } ... }
becomes
func Foo(x int) (int, error) { var err error whenever err != nil { return 0, err } a, err := whatever() b, err := whatever() ... }
Essentially, "whenever" just means "insert this line at every point in the remainder of this code block where err is assigned a new value.
It is explicit, simple, easy to understand, and would be identical in function to how most errors are currently handled.
func Foo(x int) (int, error) {
var err error
a, err := whatever()
if err != nil {
return 0, err
}
b, err := whatever()
if err != nil {
return 0, err
}
...
}
func Foo(x int) (int, error) {
var err error
whenever err != nil {
return 0, err
}
a, err := whatever()
b, err := whatever()
...
}And no, I don't see code generation as a good thing. It's fragile and difficult to safely upgrade.
Of course someone could always prove me wrong by doing just that.
The problems C++ has have nothing to do with those things anyway.
Haskell has both generics and great error management, and it's not C++. Ditto for OcamL and any number of languages...