Skip to content

Rename "Const" trait to "Freeze" #3949

Closed
@bblum

Description

@bblum

The word const currently means three things:

  • &const as a mutability qualifier, supertype of "mut" and "" (immut). Directly analogous to C/C++'s meaning.
  • const x: ty = val; for constant globals. Same as the meaning in C/C++/Java/etc.
  • T: Const as a trait, which indicates "no embedded mutability". Corresponds to nothing in any other language, as far as I know.

I propose we change the third one, and leave the other two as they are. Const doesn't even mean the data is constant (it can be borrowed as mutable). In working on the regions paper, I figured this is always used, conceptually, to indicate a "freezable" data structure -- one which becomes deeply constant only when borrowed from immutably. Let's call it that.

related #3542 #3529

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions