Skip to content

Commit 7bd39de

Browse files
Update WeekMap -> WeakMap (#59)
1 parent 8dab75c commit 7bd39de

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

2.7.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -786,9 +786,9 @@ Like `Array#union` and `#difference`, [added](2.6.html#arrayunion-and-arraydiffe
786786

787787
#### `ObjectSpace::WeakMap#[]=` now accepts non-GC-able objects[](#objectspaceweakmap-now-accepts-non-gc-able-objects)
788788

789-
* **Reason:** `ObjectSpace::WeakMap` (the `Hash` variety that doesn't hold its contents from being garbage-collected) is mostly thought, as the name implies, as an "internal" thing. But turns out it can have some legitimate usages in a regular code, for example, implementing flexible caching (cache which "auto-cleans" on garbage collection). But before this change, keys for `WeekMap` wasn't allowed to be non-GC-able (for example, numbers and symbols), which prohibits some interesting usages.
789+
* **Reason:** `ObjectSpace::WeakMap` (the `Hash` variety that doesn't hold its contents from being garbage-collected) is mostly thought, as the name implies, as an "internal" thing. But turns out it can have some legitimate usages in a regular code, for example, implementing flexible caching (cache which "auto-cleans" on garbage collection). But before this change, keys for `WeakMap` wasn't allowed to be non-GC-able (for example, numbers and symbols), which prohibits some interesting usages.
790790
* **Discussion:** <a class="tracker feature" href="https://bugs.ruby-lang.org/issues/16035">Feature #16035</a>
791-
* **Documentation:** <a class="ruby-doc" href="https://ruby-doc.org/core-2.7.0/ObjectSpace/WeakMap.html#method-i-5B-5D-3D"><code>WeekMap#[]=</code></a>
791+
* **Documentation:** <a class="ruby-doc" href="https://ruby-doc.org/core-2.7.0/ObjectSpace/WeakMap.html#method-i-5B-5D-3D"><code>WeakMap#[]=</code></a>
792792
* **Code:**
793793
```ruby
794794
map = ObjectSpace::WeakMap.new

3.3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ A new "weak map" concept implementation. Unlike `ObjectSpace::WeakMap`, it compa
478478

479479
#### `ObjectSpace::WeakMap#delete`[](#objectspaceweakmapdelete)
480480

481-
* **Reason:** `WeakMap` is frequently used to have a loose list of objects that will need some processing at some point of program execution if they are still alive/used (that's why `WeekMap` and not `Array`/`Hash` is chosen in those cases). But it is possible that the code author wants to process objects conditionally, and to remove those which don't need processing anymore—even if they are still alive. `WeekMap` quacks like kind-of simple `Hash`, yet previously provided no way to delete keys.
481+
* **Reason:** `WeakMap` is frequently used to have a loose list of objects that will need some processing at some point of program execution if they are still alive/used (that's why `WeakMap` and not `Array`/`Hash` is chosen in those cases). But it is possible that the code author wants to process objects conditionally, and to remove those which don't need processing anymore—even if they are still alive. `WeakMap` quacks like kind-of simple `Hash`, yet previously provided no way to delete keys.
482482
* **Discussion:** <a class="tracker feature" href="https://bugs.ruby-lang.org/issues/19561">Feature #19561</a>
483483
* **Documentation:** <a class="ruby-doc" href="https://docs.ruby-lang.org/en/3.3/ObjectSpace/WeakMap.html#method-i-delete"><code>ObjectSpace::WeakMap#delete</code></a>
484484
* **Code:**

_src/2.7.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -786,9 +786,9 @@ Like `Array#union` and `#difference`, [added](2.6.html#arrayunion-and-arraydiffe
786786

787787
#### `ObjectSpace::WeakMap#[]=` now accepts non-GC-able objects
788788

789-
* **Reason:** `ObjectSpace::WeakMap` (the `Hash` variety that doesn't hold its contents from being garbage-collected) is mostly thought, as the name implies, as an "internal" thing. But turns out it can have some legitimate usages in a regular code, for example, implementing flexible caching (cache which "auto-cleans" on garbage collection). But before this change, keys for `WeekMap` wasn't allowed to be non-GC-able (for example, numbers and symbols), which prohibits some interesting usages.
789+
* **Reason:** `ObjectSpace::WeakMap` (the `Hash` variety that doesn't hold its contents from being garbage-collected) is mostly thought, as the name implies, as an "internal" thing. But turns out it can have some legitimate usages in a regular code, for example, implementing flexible caching (cache which "auto-cleans" on garbage collection). But before this change, keys for `WeakMap` wasn't allowed to be non-GC-able (for example, numbers and symbols), which prohibits some interesting usages.
790790
* **Discussion:** [Feature #16035](https://bugs.ruby-lang.org/issues/16035)
791-
* **Documentation:** [WeekMap#[]=](https://ruby-doc.org/core-2.7.0/ObjectSpace/WeakMap.html#method-i-5B-5D-3D)
791+
* **Documentation:** [WeakMap#[]=](https://ruby-doc.org/core-2.7.0/ObjectSpace/WeakMap.html#method-i-5B-5D-3D)
792792
* **Code:**
793793
```ruby
794794
map = ObjectSpace::WeakMap.new

_src/3.3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ A new "weak map" concept implementation. Unlike `ObjectSpace::WeakMap`, it compa
478478

479479
#### `ObjectSpace::WeakMap#delete`
480480

481-
* **Reason:** `WeakMap` is frequently used to have a loose list of objects that will need some processing at some point of program execution if they are still alive/used (that's why `WeekMap` and not `Array`/`Hash` is chosen in those cases). But it is possible that the code author wants to process objects conditionally, and to remove those which don't need processing anymore—even if they are still alive. `WeekMap` quacks like kind-of simple `Hash`, yet previously provided no way to delete keys.
481+
* **Reason:** `WeakMap` is frequently used to have a loose list of objects that will need some processing at some point of program execution if they are still alive/used (that's why `WeakMap` and not `Array`/`Hash` is chosen in those cases). But it is possible that the code author wants to process objects conditionally, and to remove those which don't need processing anymore—even if they are still alive. `WeakMap` quacks like kind-of simple `Hash`, yet previously provided no way to delete keys.
482482
* **Discussion:** [Feature #19561](https://bugs.ruby-lang.org/issues/19561)
483483
* **Documentation:** [ObjectSpace::WeakMap#delete](https://docs.ruby-lang.org/en/3.3/ObjectSpace/WeakMap.html#method-i-delete)
484484
* **Code:**

0 commit comments

Comments
 (0)