Hacker News new | ask | show | jobs
by veber-alex 300 days ago
Why does the compiler decay the FileError and the global error set to an integer? If they were unique types, the if statement would not have compiled.
1 comments

`FileError.AccessDenied` is a unique value in a unique error set. `error.AccessDenid` has not been defined anywhere and hence is just given an integer value at some point by the compiler.

As I stated before, this error wouldn't even exist in the first place in no codebase ever: look how the method that fails returns a `FileError` and not an `anyerror`

It could be rightly argued that it still shouldn't compile though.