Skip to content

Clarify terminology around destructors and dropping #1078

Open
@ehuss

Description

@ehuss

In #1037 a question came up about the exact wording around the introduction of the destructors chapter which says

When an initialized variable or temporary goes out of scope its destructor is run, or it is dropped.

The PR author interpreted the phrase dropped meaning a synonym for running the destructor. But I read it as two separate concepts:

  • When any value goes out of scope, it is "dropped".
  • If the value has a destructor, that destructor is run.

I don't think "dropping" and "running destructors" can be used interchangeably because not all values have a destructor. However, I am uncertain if that is correct, or if that is the best way to document these concepts. Either way, it would be good to clarify that a little.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-destructorsArea: destructors, droppingLanguage CleanupImprovements to existing language which is correct but not clear, or missing examples, or the like.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions