←back to thread

311 points thunderbong | 1 comments | | HN request time: 0.211s | source
Show context
adontz ◴[] No.42202248[source]
This is a good example of "stringly typed" software. Golang designers did not want exceptions (still have them with panic/recover), but untyped errors are evil. On the other hand, how would one process typed errors without pattern matching? Because "catch" in most languages is a [rudimentary] pattern matching.

https://learn.microsoft.com/en-us/dotnet/csharp/language-ref...

replies(1): >>42202266 #
KRAKRISMOTT ◴[] No.42202266[source]
Go has typed errors, it just didn't use it in this case.
replies(7): >>42202277 #>>42202378 #>>42202617 #>>42203319 #>>42205600 #>>42206561 #>>42208318 #
1. karel-3d ◴[] No.42206561[source]
They didn't have them when they implemented this code.

Back then, error was a glorified string. Then it started having more smart errors, mostly due to a popular third party packages, and then the logic of those popular packages was more or less* put back to go.

* except for stacktraces in native errors. I understand that they are not there for speed reasons but dang it would be nice to have them sometimes