Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
Thaxll
· 2y ago · 0 comments
I've never seen or used reflection with error handling in Go, what do you mean?
Comments
[–]
sidlls
2y ago
https://cs.opensource.google/go/go/+/refs/tags/go1.21.6:src/...
[–]
derekperkins
2y ago
I wouldn't classify type assertion as reflection. It's a super fast type check of the object header, not dynamic reflection.
[–]
Thaxll
OP
2y ago
But this is a detail of implementation, user code does not use reflection with errors.
[–]
sidlls
2y ago
That "detail of implementation" is what is used by user code, e.g., `myError.As(...)` uses reflection, implicitly.
[–]
Thaxll
OP
2y ago
Then what? It has 0 performance impact, we're talking about error handling here, it's rare and not in hot path.