3 ms·
"Where line 9 there just blindly assumes the regex found a match, and causes quite the run-time error message." You blindly assume the regex found a match, bec
by jff 12y ago
"Where line 9 there just blindly assumes the regex found a match, and causes quite the run-time error message."
You blindly assume the regex found a match, because you ignored the part of the docs where they tell you how to check for a match: http://golang.org/pkg/regexp/#Regexp.FindStringSubmatch http://golang.org/pkg/regexp/#Regexp.FindStringSubmatch
- sswezey 12y agoThe article didn't say there was no way to check, just that the compiler does not enforce checking. Rust's type system requires that all possible paths are accounted for when trying to extract the value from the option.
- humanrebar 12y agoThe point is that Rust gives you a compiler error while Go assumes your sloppy code is intentional or unimportant.