Creates a sink collecting the distinct items of the feed into a set.
Items are made immutable as they are collected, in first-appearance order, and compared with SameValueZero
semantics, so NaN matches itself and -0 matches 0.
The returned set is frozen, with add, delete and clear shadowed by own properties that throw: entries cannot
be altered through the set, although mutating methods invoked directly on Set.prototype still reach the internal
slots backing them.
Warning
Exhaustive: every item is collected before the sink resolves, so an infinite feed never completes.
Materialising: the whole feed is held in memory, so a large feed may exhaust it.
Stateful: the set covers the items drawn, so a sink closing a nested or truncated feed sees those alone.
Warning
Freezing clones structured items, giving them a fresh identity: entries are not reachable through the original
item reference, and the same mutable item collected twice yields two distinct entries rather than being
deduplicated. Supply structured items as immutable values to keep their identity stable.
Creates a sink collecting the distinct items of the feed into a set.
Items are made immutable as they are collected, in first-appearance order, and compared with
SameValueZerosemantics, soNaNmatches itself and-0matches0.The returned set is frozen, with
add,deleteandclearshadowed by own properties that throw: entries cannot be altered through the set, although mutating methods invoked directly onSet.prototypestill reach the internal slots backing them.Freezing clones structured items, giving them a fresh identity: entries are not reachable through the original item reference, and the same mutable item collected twice yields two distinct entries rather than being deduplicated. Supply structured items as immutable values to keep their identity stable.