HN Theater @HNTheaterMonth

The best talks and videos of Hacker News.

Hacker News Comments on
Steve Francia - Go: building on the shoulders of giants and stepping on a few toes

Curry On! · Youtube · 87 HN points · 2 HN comments
HN Theater has aggregated all Hacker News stories and comments that mention Curry On!'s video "Steve Francia - Go: building on the shoulders of giants and stepping on a few toes".
HN Theater Rankings

Hacker News Stories and Comments

All the comments and stories posted to Hacker News that reference this video.
Aug 03, 2018 · jomi-se on Announcing Rust 1.28
They have pretty solid reasons on why they are delaying the support for generics actually.

Check this out https://www.youtube.com/watch?v=sX8r6zATHGU

Jul 26, 2018 · 87 points, 23 comments · submitted by davecheney
mseepgood
Intersting talk. Here are some other talks about the history and origins of Go:

Evolution of Go (Griesemer, GopherCon 2015)

Video: https://www.youtube.com/watch?v=0ReKdcpNyQg

Slides: https://talks.golang.org/2015/gophercon-goevolution.slide

Origins of Go Concurrency (Rob Pike, OSCON 2010)

Video: https://www.youtube.com/watch?v=3DtUzH3zoFo

Slides: http://go-lang.cat-v.org/talks/slides/emerging-languages-cam...

Davesjoshin
Presenter has a great sense of humor. For someone who hadn't known much about GO, this was a great overview. Thanks
geoka9
Obligatory, the take on generics: https://www.youtube.com/watch?v=sX8r6zATHGU&t=50m29s
pjmlp
The usual hand waving answer, "we are thinking about it until the perfect design falls from the sky", nothing new.
fpoling
It is interesting that neither the talk nor the questions from the audience rise the question of the error handling.

In Go returning an error implies that the caller will need to add 3 lines of the source for each call to propagate the error. This is really ugly. Rust managed to reduce that source overhead down to the single extra ? character while keeping all the benefits of explicit error handling. I wish Go gets something similar.

everdev
This is a huge complaint of those new to Go and touted as a benefit from those who still use it.

Being explicit is a double edge sword. It requires more typing, but there's also no don't about what the code is doing.

zephyrfalcon
"Explicit" doesn't necessarily have to mean "verbose", though.
stouset
Thank you! You know what’s also “explicit”? Typing out assembly by hand. Somehow everything lower level than Go is totally fine to hide from the developer, but any ergonomics improvements at all and go would “no longer be simple and explicit”.
kybernetikos
As far as I'm concerned 'explicit' just means that the behaviour under discussion is caused by some piece of source that talks about that behaviour and not something else.

Whether the bit of source is a single character or a paragraph of prose is about verbosity rather than explicitness as long as the behaviour under discussion is caused by a piece of source with precisely that purpose.

scubaguy
https://blog.golang.org/errors-are-values

This article does not read like "touting as a benefit". Excerpt from it:

Still, if the perception persists that one must type

  if err != nil
all the time, something must be wrong, and the obvious target is Go itself.

This is unfortunate, misleading, and easily corrected. Perhaps what is happening is that programmers new to Go ask, "How does one handle errors?", learn this pattern, and stop there.

gregwebs
The question mark in Rust is equally explicit in the case where it can be used to simply pass the error along.
steveklabnik
And in cases where you don’t, various combinators let you handle common patterns more easily too.

You can also write it Go style if you prefer; we started off with exactly that, then moved to a macro, then turned that macro into ?.

That all being said, none of that feels very Go-like, so it makes sense that they haven’t followed what we did.

vram22
>You can also write it Go style if you prefer; we started off with exactly that, then moved to a macro, then turned that macro into ?.

Interesting. Does the Rust book (you wrote), explain the difference between the Go style and the current Rust style, and explain how to use the Rust style (well)?

Asking because I've found this Some / None stuff (also there in other languages like F#) a little tricky to understand (although I have not spent a lot of time on it yet).

steveklabnik
We talk about it a little, but the best resource on this topic by far is https://blog.burntsushi.net/rust-error-handling/ which works the whole way from first principles. It was in the first edition of the book but due to space requirements didn’t really fit in the second edition.
vram22
Thanks, will check that blog out.
steveklabnik
No problem! In general, burntsushi’s work is some of the best in Rust. He’s also very fluent in Go.
vram22
Good to know, will check out his stuff in both languages, thanks.
everdev
I personally prefer the more concise version :)
kjeetgill
On a related note, Rust's hygenic macro system is simply amazing.

If you're only familiar with macros from C or C++ take a look. The basic idea is that your macro fictions don't use input text and output text. Instead they accept an Abstract Syntax Tree and return a known AS THE. That way the expansion plays well with the grammer.

It also manages separate variable scopes well. You only get bleed if you want it.

I used to shudder at the thought of macros but I'm convinced. Java or Go could use them reasonably I think.

I'm not a rust programer so my understand is probably a little wrong. I'm not intimately familiar with all of the details. Correct me if I'm mistaken!

sacado2
I don't know, most of the time, I add information to the error before propagating it:

    if f, err := os.Open(path); err != nil {
        return nil, fmt.Errorf("could not open path: %v", err)
    }
This is the vast majority of my error management code in go. Is rust less verbose in this regard? AFAIK, the question mark operator is equivalent to `if err != nil { return nil, err }`.
steveklabnik
If you want to transform the error on it, you can either:

1. Define a conversion between the two errors that adds the context.

2. Use .map_err() at the callsite to do the transformation there.

sacado2
Thank you Steve. I'll have a look at map_err().
tomcam
In my experience creating robust, usable code that responds properly to adverse conditions always requires tons of error handling. The closer to the problem you deal with it the more accurate your diagnostics can be. Otherwise it becomes very difficult to provide meaningful feedback to the user.
stouset
Nothing in your comment counters the GP’s statement that Rust manages to accomplish this with a single character, simultaneously avoiding needlessly obscuring the happy path and without the downsides of non-local error handling.
HN Theater is an independent project and is not operated by Y Combinator or any of the video hosting platforms linked to on this site.
~ yaj@
;laksdfhjdhksalkfj more things
yahnd.com ~ Privacy Policy ~
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.