Y
Hacker News
new
|
ask
|
show
|
jobs
by
Thaxll
895 days ago
But this is a detail of implementation, user code does not use reflection with errors.
1 comments
sidlls
895 days ago
That "detail of implementation" is what is used by user code, e.g., `myError.As(...)` uses reflection, implicitly.
link
Thaxll
895 days ago
Then what? It has 0 performance impact, we're talking about error handling here, it's rare and not in hot path.
link
sidlls
895 days ago
It does not have 0 performance impact, it's not rare, and in applications that are in the hot path, error handling is
also
in the hot path.
link
Thaxll
895 days ago
No, it only executes when you enter the err != nil block so it's almost never called, again 0 impact on performance.
link