Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/destructors.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ r[destructors]

r[destructors.intro]
When an [initialized] [variable] or [temporary] goes out of
[scope](#drop-scopes), its *destructor* is run, or it is *dropped*. [Assignment]
also runs the destructor of its left-hand operand, if it's initialized. If a
variable has been partially initialized, only its initialized fields are
dropped.
[scope](#drop-scopes), it is *dropped*, which means its *destructor* is run.
(The two terms are used interchangeably here.)
Comment on lines +6 to +7
Copy link
Contributor

@traviscross traviscross Oct 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dropped and destructor aren't the two terms used interchangeably. (We use the emphasis to define terms, so what's under emphasis matters here.) While extending the emphasis on the latter to include "is run" would be one option, that reads strangely to me still, so maybe there are other options here.

It'd seem better to me if we could find a factoring that avoided this parenthetical. This is just an introduction. Maybe something like reversing the terms back to the original order and saying something like "When a value or temporary goes out of scope and its destructor is run, we say that it has been dropped."

(I'm happy to make the revision here if something along these lines sounds OK to you.)

(This assumes that we want to treat these as equated, which as I mentioned in private communication, is probably not how this is meant currently.)

Copy link
Member Author

@joshtriplett joshtriplett Oct 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with this PR having flagged the underlying issue; feel free to edit and merge, as I'm not attached to the exact wording here and I'm not currently building anything further atop this.

[Assignment] also runs the destructor of its left-hand operand, if it's
initialized. If a variable has been partially initialized, only its initialized
fields are dropped.

r[destructors.operation]
The destructor of a type `T` consists of:
Expand Down