An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

github.com/jba/weakmap

Package weakmap implements a map with weak keys. One use for such a map is storing auxiliary data with values that are not under your control. For example, if you wanted to associated additional information with values of some type *p.T, where package p is not under your control, you could use a weakmap whose keys are *p.T values and whose values are your additional information. // The advantage over using an ordinary map is that when a *p.T gets garbage-collected, your associated data is removed from the map. This should be considered a proof of concept, for educational purposes only. The problem is that the implementation requires setting a finalizer on the keys, which removes any existing finalizer. There is no way for the program to tell if there is an existing finalizer, so it cannot detect this problem.

Ecosystem
proxy.golang.org
Versions
0
Links
Registry proxy.golang.org
Source Repository
Docs Documentation
JSON API View JSON
CodeMeta codemeta.json
Package Details
PURL pkg:golang/github.com/jba/weakmap
spec
License MIT
Namespace github.com/jba
Last Synced 26 days ago
Repository
Stars 0 on GitHub
Forks 0 on GitHub
Rankings on proxy.golang.org
Overall Top 7.4%