AlekSi/pointer

Changing semnatics of the functions

royKarseboom opened this issue · 1 comments

Hi, I find the pointer.ToX(v X) *X a bit confusing since by reading it (without looking at the parameter and return value) I would think it would turn a pointer of X to the value X, which it doesn't.
Maybe we could change it to ptr.OfX(v X) *X
Also, in a similar manner, I think pointer.GetX(v *X) X would be clearer as ptr.ToX(v *X) X
To summerize, I'm suggesting the following changes

pointer.ToX(v X) *X -> ptr.OfX(v X) *X
pointer.GetX(v *X) X -> ptr.ToX(v *X) X

I don't mind opening the PR, would you accept?

I read pointer.ToX(v X) as "[give me a] pointer to X".

In any case, that module will not have breaking changes in v1, and I plan to wait for golang/go#9097 or golang/go#45624 to be accepted and implemented before I release v2. If you want a different syntax, and you already have some module in from the list at #8 in dependencies, you might want to use them instead.