Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use value receiver for String() #183

Open
kaber2 opened this issue Aug 17, 2024 · 0 comments
Open

Use value receiver for String() #183

kaber2 opened this issue Aug 17, 2024 · 0 comments

Comments

@kaber2
Copy link

kaber2 commented Aug 17, 2024

I often embed uint256.Int types directly into a struct to avoid the overhead of memory allocation, GC, the pointer memory storage and associated cache misses when following the pointers. When printing such a struct using %v however, the Ints are displayed as an array of their uint64 values.

Can we change the String() method to a value receiver instead? For values of type *T, the methods of T are within its method set, so this would work for both *uint256.Int and uint256.Int.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant