diff options
Diffstat (limited to 'doc/next/6-stdlib/2-unique.md')
-rw-r--r-- | doc/next/6-stdlib/2-unique.md | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/doc/next/6-stdlib/2-unique.md b/doc/next/6-stdlib/2-unique.md new file mode 100644 index 0000000000..b2c3bdfd0d --- /dev/null +++ b/doc/next/6-stdlib/2-unique.md @@ -0,0 +1,13 @@ +### New unique package + +The new [unique](/pkg/unique) package provides facilites for +canonicalizing values (like "interning" or "hash-consing"). + +Any value of comparable type may be canonicalized with the new +`Make[T]` function, which produces a reference to a canonical copy of +the value in the form of a `Handle[T]`. +Two `Handle[T]` are equal if and only if the values used to produce the +handles are equal, allowing programs to deduplicate values and reduce +their memory footprint. +Comparing two `Handle[T]` values is efficient, reducing down to a simple +pointer comparison. |