weak: improve grammar in doc comments

Change-Id: I577b8a6bf2b7d899cc7ff7211c73549c90db9d94
Reviewed-on: https://go-review.googlesource.com/c/go/+/637355
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
Michal Bohuslávek 2024-12-18 13:32:37 +01:00 committed by Gopher Robot
parent f4e3ec3dbe
commit 87dbfb9fa7

View file

@ -13,9 +13,9 @@ import (
// Pointer is a weak pointer to a value of type T.
//
// Just like regular pointers, Pointer may reference any part of an
// object, such as the field of a struct or an element of an array.
// object, such as a field of a struct or an element of an array.
// Objects that are only pointed to by weak pointers are not considered
// reachable and once the object becomes unreachable [Pointer.Value]
// reachable, and once the object becomes unreachable, [Pointer.Value]
// may return nil.
//
// The primary use-cases for weak pointers are for implementing caches,
@ -23,19 +23,19 @@ import (
// the lifetimes of separate values (for example, through a map with weak
// keys).
//
// Two Pointer values always compare equal if the pointers that they were
// created from compare equal. This property is retained even after the
// Two Pointer values always compare equal if the pointers from which they were
// created compare equal. This property is retained even after the
// object referenced by the pointer used to create a weak reference is
// reclaimed.
// If multiple weak pointers are made to different offsets within same object
// If multiple weak pointers are made to different offsets within the same object
// (for example, pointers to different fields of the same struct), those pointers
// will not compare equal.
// If a weak pointer is created from an object that becomes unreachable, but is
// then resurrected due to a finalizer, that weak pointer will not compare equal
// with weak pointers created after resurrection.
// with weak pointers created after the resurrection.
//
// Calling [Make] with a nil pointer returns a weak pointer whose [Pointer.Value]
// always returns nil. The zero value of a Pointer behaves as if it was created
// always returns nil. The zero value of a Pointer behaves as if it were created
// by passing nil to [Make] and compares equal with such pointers.
//
// [Pointer.Value] is not guaranteed to eventually return nil.