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

runtime: SetFinalizer documentation ambiguous or confusing #24480

Closed
seebs opened this issue Mar 21, 2018 · 2 comments
Closed

runtime: SetFinalizer documentation ambiguous or confusing #24480

seebs opened this issue Mar 21, 2018 · 2 comments
Labels
Documentation FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@seebs
Copy link
Contributor

seebs commented Mar 21, 2018

What version of Go are you using (go version)?

1.10

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

N/A; this is a documentation bug.

What did you do?

Read the documentation.

What did you expect to see?

Something clearer.

What did you see instead?

The documentation for runtime.SetFinalizer says:

The finalizer for obj is scheduled to run at some arbitrary time after obj becomes unreachable.

The text as a whole strongly suggests that the meaning is "at some arbitrary time after the object pointed to by obj becomes unreachable".

Consider:

p := &something
{
q := p
runtime.SetFinalizer(q, ...)
}
// can the finalizer be invoked here, as q is now unreachable?

Consensus among some devs is that the answer is probably "no", but the actual words used appear to state that, since obj (q) is unreachable, the finalizer can run.

@bcmills
Copy link
Contributor

bcmills commented Mar 22, 2018

(CC: @aclements, @RLH for GC terminology)

@bcmills bcmills added this to the Go1.11 milestone Mar 22, 2018
@bcmills bcmills added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 22, 2018
@ALTree ALTree changed the title SetFinalizer documentation ambiguous or confusing runtime: SetFinalizer documentation ambiguous or confusing Mar 22, 2018
@ianlancetaylor ianlancetaylor added the NeedsFix The path to resolution is known, but the work has not been done. label Jul 7, 2018
@gopherbot gopherbot removed the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 7, 2018
@gopherbot
Copy link

Change https://golang.org/cl/122557 mentions this issue: runtime: clarify SetFinalizer docs

@golang golang locked and limited conversation to collaborators Jul 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants