Skip to content

Rc/Arc: get rid of "value" terminology #64484

Closed
@RalfJung

Description

@RalfJung

The Rc docs use the term "value" to refer to an RcBox instance (and similar for Arc). That's IMO a bad use of terminology: A "value" is something like "5" or "true" that does not have an identity beyond its mathematical interpretation; an RcBox has a location so that even two distinct RcBox that contain the same value (say, both contain "5") are "not the same".

This is particularly bad in the docs for ptr_eq:

Returns true if the two Rcs point to the same value (not just values that compare as equal).

"5" and "5" are the same value, and yet Rc::ptr_eq(&Rc::new(5), &Rc::new(5)) returns false. So IMO the docs are just wrong -- or rather, they are using the term "value" in the wrong way.

I suggest that we replace all/most uses of "value" in these docs by "reference-counted object" or maybe something involving "instance". I think that better conveys what is happening.

Opinions? Cc @Centril @SimonSapin @gnzlbg

Metadata

Metadata

Assignees

Labels

A-docsArea: Documentation for any part of the project, including the compiler, standard library, and tools

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions