Try not to use any interface as a generalization #209

Open
opened 2025-12-28 18:07:26 +00:00 by sami · 0 comments
Owner

Originally created by @carpawell on GitHub (Dec 15, 2023).

I'm always frustrated when I see any keyword when the code needs to do some common actions with the different structs. We have generics for that for more than 1.5 years already. One of such funcs is signing and verification. They are the hot ones in an average NeoFS application so even a small optimization can be good.

Describe the solution you'd like

Try to use generics here. I am not sure it is really possible but still we can try it. Do some benchmarks (but even if the outcome is not that good, I would always prefer a generic version over the any one).

Describe alternatives you've considered

Do nothing.

Originally created by @carpawell on GitHub (Dec 15, 2023). ## Is your feature request related to a problem? Please describe. I'm always frustrated when I see `any` keyword when the code needs to do some common actions with the different structs. We have generics for that for more than 1.5 years already. One of such funcs is [signing](https://github.com/nspcc-dev/neofs-sdk-go/blob/6f4790451fa1d7c8756addff45ca2e741e79b3bc/client/sign.go#L137) and [verification](https://github.com/nspcc-dev/neofs-sdk-go/blob/6f4790451fa1d7c8756addff45ca2e741e79b3bc/client/sign.go#L213). They are the hot ones in an average NeoFS application so even a small optimization can be good. ## Describe the solution you'd like Try to use generics here. I am not sure it is really possible but still we can try it. Do some benchmarks (but even if the outcome is not that good, I would always prefer a generic version over the `any` one). ## Describe alternatives you've considered Do nothing.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nspcc-dev/neofs-sdk-go#209
No description provided.