Merge pull request #2331 from vsemozhetbyt/patch-4

Fix typos in 1.5.8 (WeakMap and WeakSet)
This commit is contained in:
Ilya Kantor 2020-12-05 19:39:39 +03:00 committed by GitHub
commit b563d4d08c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -284,7 +284,8 @@ The most notable limitation of `WeakMap` and `WeakSet` is the absence of iterati
`WeakSet` is `Set`-like collection that stores only objects and removes them once they become inaccessible by other means.
It's main advantages are that they have weak reference to objects, so they can easily be removed by garbage colector.
Their main advantages are that they have weak reference to objects, so they can easily be removed by garbage colector.
That comes at the cost of not having support for `clear`, `size`, `keys`, `values`...
`WeakMap` and `WeakSet` are used as "secondary" data structures in addition to the "primary" object storage. Once the object is removed from the primary storage, if it is only found as the key of `WeakMap` or in a `WeakSet`, it will be cleaned up automatically.