Skip to content

Commit

Permalink
Better wording in interior mutability section
Browse files Browse the repository at this point in the history
  • Loading branch information
seanbaxter committed Oct 2, 2024
1 parent 9c39fc3 commit 4c599c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions docs/draft.html
Original file line number Diff line number Diff line change
Expand Up @@ -4338,13 +4338,13 @@ <h2 data-number="2.6" id="interior-mutability"><span class="header-section-numbe
<code class="sourceCode cpp">unsafe_cell</code> to safely strip the
const off shared borrows, allowing users to mutate the protected
resource.</p>
<p>Safe C++ and Rust and conflate exclusive access with mutable borrows
and shared access with const borrows. It’s is an economical choice,
because one type qualifier,
<p>Safe C++ and Rust conflate exclusive access with mutable borrows and
shared access with const borrows. It’s is an economical choice, because
one type qualifier,
<code class="sourceCode cpp"><span class="kw">const</span></code> or
<code class="sourceCode cpp">mut</code>, also determines exclusivity.
But the cast-away-const model of interior mutability is an awkward
consequence. But this design is not the only way: The Ante language<span class="citation" data-cites="ante">[<a href="https://antelang.org/blog/safe_shared_mutability/#shared-interior-mutability" role="doc-biblioref">ante</a>]</span> experiments with separate
consequence. This design may not be the only way: The Ante language<span class="citation" data-cites="ante">[<a href="https://antelang.org/blog/safe_shared_mutability/#shared-interior-mutability" role="doc-biblioref">ante</a>]</span> experiments with separate
<code class="sourceCode cpp">own mut</code> and
<code class="sourceCode cpp">shared mut</code> qualifiers. That’s really
attractive, because you’re never mutating something through a const
Expand Down
2 changes: 1 addition & 1 deletion proposal/draft.md
Original file line number Diff line number Diff line change
Expand Up @@ -2553,7 +2553,7 @@ Lifetime safety also guarantees that the `lock_guard` is in scope (meaning the m
Interior mutability is a legal loophole around exclusivity. You're still limited to one mutable borrow or any number of shared borrows to an object. Types with a deconfliction strategy use `unsafe_cell` to safely strip the const off shared borrows, allowing users to mutate the protected resource.
Safe C++ and Rust and conflate exclusive access with mutable borrows and shared access with const borrows. It's is an economical choice, because one type qualifier, `const` or `mut`, also determines exclusivity. But the cast-away-const model of interior mutability is an awkward consequence. But this design is not the only way: The Ante language[@ante] experiments with separate `own mut` and `shared mut` qualifiers. That's really attractive, because you're never mutating something through a const reference. This three-state system doesn't map onto C++'s existing type system as easily, but that doesn't mean the const/mutable borrow treatment, which does integrate elegantly, is the most expressive. A `shared` type qualifier merits investigation during the course of this project.
Safe C++ and Rust conflate exclusive access with mutable borrows and shared access with const borrows. It's is an economical choice, because one type qualifier, `const` or `mut`, also determines exclusivity. But the cast-away-const model of interior mutability is an awkward consequence. This design may not be the only way: The Ante language[@ante] experiments with separate `own mut` and `shared mut` qualifiers. That's really attractive, because you're never mutating something through a const reference. This three-state system doesn't map onto C++'s existing type system as easily, but that doesn't mean the const/mutable borrow treatment, which does integrate elegantly, is the most expressive. A `shared` type qualifier merits investigation during the course of this project.
* `T^` - Exclusive mutable access. Permits standard conversion to `shared T^` and `const T^`.
* `shared T^` - Shared mutable access. Permits standard conversion to `const T^`. Only types that enforce interior mutability have overloads with shared mutable access.
Expand Down

0 comments on commit 4c599c1

Please sign in to comment.