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

reflect: deprecate PtrTo #59599

Closed
gazerro opened this issue Apr 13, 2023 · 15 comments
Closed

reflect: deprecate PtrTo #59599

gazerro opened this issue Apr 13, 2023 · 15 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. help wanted Proposal Proposal-Accepted
Milestone

Comments

@gazerro
Copy link
Contributor

gazerro commented Apr 13, 2023

The reflect.PointerTo function was added in version 1.18 to replace the reflect.PtrTo function. reflect.PtrTo was supposed to be deprecated in version 1.19, as recommended in https://github.com/golang/go/wiki/Deprecated, but it was not done.

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Apr 13, 2023
@seankhliao seankhliao changed the title reflect: deprecate PtrTo proposal: reflect: deprecate PtrTo Apr 13, 2023
@gopherbot gopherbot added this to the Proposal milestone Apr 13, 2023
@randall77
Copy link
Contributor

See #48665

@gophun
Copy link

gophun commented Apr 13, 2023

According to this 1.21 will already be 1.N+3

@ianlancetaylor
Copy link
Contributor

CC @mvdan : OK with deprecating these now?

@mvdan
Copy link
Member

mvdan commented Apr 14, 2023

Per the rules we agreed on and wrote on https://github.com/golang/go/wiki/Deprecated, yes, I'm perfectly fine with deprecating at this point :)

@rsc
Copy link
Contributor

rsc commented May 24, 2023

This proposal has been added to the active column of the proposals project
and will now be reviewed at the weekly proposal review meetings.
— rsc for the proposal review group

@rsc
Copy link
Contributor

rsc commented May 31, 2023

go.dev/wiki/Deprecated says:

Marking an API feature deprecated can create work and decisions for millions of Go developers using the feature. An API feature should only be marked deprecated if its use is problematic in some way, not simply because something newer exists.

It is unclear to me that PtrTo really is "problematic in some way". It's just an old spelling, and the doc comment for PtrTo calls that out. It seems like we should not mark it Deprecated based on this.

@rsc
Copy link
Contributor

rsc commented Jun 7, 2023

Based on the discussion above, this proposal seems like a likely decline.
— rsc for the proposal review group

@andig
Copy link
Contributor

andig commented Jun 7, 2023

I don‘t have strong feelings either way. However, one of Go‘s strength is to have exactly one way of doing things. This seems to imply that adding another way should include deprecating the old way.

@bcmills
Copy link
Contributor

bcmills commented Jun 7, 2023

Presumably if we were to mark it as deprecated, that could allow IDEs to downrank it in suggested code completions. Do we have some other way to feed in that signal for old names with preferred alternatives?

@gazerro
Copy link
Contributor Author

gazerro commented Jun 7, 2023

I'm not against rejecting this proposal; the reasons make sense. But in the past, a different approach must have been used to decide whether a feature should be deprecated or not. Look at the functions in the ioutils package, for example.

@rsc
Copy link
Contributor

rsc commented Jun 14, 2023

@gazerro, thanks for pointing that out. We have indeed not been following that part of the policy, so I've removed that sentence, and then this becomes a likely accept.

@rsc
Copy link
Contributor

rsc commented Jun 14, 2023

Based on the discussion above, this proposal seems like a likely accept.
— rsc for the proposal review group

@rsc
Copy link
Contributor

rsc commented Jun 21, 2023

No change in consensus, so accepted. 🎉
This issue now tracks the work of implementing the proposal.
— rsc for the proposal review group

@rsc rsc changed the title proposal: reflect: deprecate PtrTo reflect: deprecate PtrTo Jun 21, 2023
@rsc rsc modified the milestones: Proposal, Backlog Jun 21, 2023
qiulaidongfeng added a commit to qiulaidongfeng/go that referenced this issue Jul 19, 2023
Replace reflect.PtrTo with reflect.PointerTo

Fixes golang#59599

Change-Id: I49407193e2050543ef983cd637703acc682d9f51
@gopherbot
Copy link

Change https://go.dev/cl/511035 mentions this issue: reflect: deprecate PtrTo

qiulaidongfeng added a commit to qiulaidongfeng/go that referenced this issue Jul 21, 2023
Replace reflect.PtrTo with reflect.PointerTo

Fixes golang#59599

Change-Id: I49407193e2050543ef983cd637703acc682d9f51
qiulaidongfeng added a commit to qiulaidongfeng/go that referenced this issue Jul 21, 2023
Replace reflect.PtrTo with reflect.PointerTo

Fixes golang#59599

Change-Id: I49407193e2050543ef983cd637703acc682d9f51
qiulaidongfeng added a commit to qiulaidongfeng/go that referenced this issue Jul 22, 2023
Replace reflect.PtrTo with reflect.PointerTo

Fixes golang#59599

Change-Id: I49407193e2050543ef983cd637703acc682d9f51
qiulaidongfeng added a commit to qiulaidongfeng/go that referenced this issue Jul 22, 2023
Replace reflect.PtrTo with reflect.PointerTo

Fixes golang#59599

Change-Id: I49407193e2050543ef983cd637703acc682d9f51
qiulaidongfeng added a commit to qiulaidongfeng/go that referenced this issue Jul 26, 2023
Replace reflect.PtrTo with reflect.PointerTo

Fixes golang#59599

Change-Id: I49407193e2050543ef983cd637703acc682d9f51
@gopherbot
Copy link

Change https://go.dev/cl/548036 mentions this issue: doc/go1.22: document that reflect.PtrTo is deprecated

gopherbot pushed a commit that referenced this issue Dec 8, 2023
Updates #59599.
For #61422.

Change-Id: I923be38b719a78dd983372acad93f710a53b0922
Reviewed-on: https://go-review.googlesource.com/c/go/+/548036
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Bypass: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
ezz-no pushed a commit to ezz-no/go-ezzno that referenced this issue Feb 18, 2024
Updates golang#59599.
For golang#61422.

Change-Id: I923be38b719a78dd983372acad93f710a53b0922
Reviewed-on: https://go-review.googlesource.com/c/go/+/548036
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Bypass: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. help wanted Proposal Proposal-Accepted
Projects
Status: Accepted
Development

Successfully merging a pull request may close this issue.

10 participants