You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The coexistence of (s Set) and (s *Set) can cause problems. For instance, if a consumer of the library were to create an interface to represent a subset of methods Clear can't go on the same interface as the other methods since Set and *Set are treated as two different types.
There are a few ways to handle this:
The implementation of Clear could be replaced by a slower version that calls Pop until the Set is empty.
Clearcould be removed altogether, leaving the consumer to implement a for loop calling Pop if necessary.
Alternatively, all other methods could be changed to use *Set. This may seem heavy handed at first but since it's not necessary to explicitly take the pointer of a Set variable to call *Set methods this incurs no penalty on the consumer. If Immutable set type / frozenset #1 is implemented it would be a nice symmetry to have the mutable type use a pointer and the immutable type avoid it.
The text was updated successfully, but these errors were encountered:
The coexistence of
(s Set)
and(s *Set)
can cause problems. For instance, if a consumer of the library were to create an interface to represent a subset of methodsClear
can't go on the same interface as the other methods sinceSet
and*Set
are treated as two different types.There are a few ways to handle this:
Clear
could be replaced by a slower version that callsPop
until theSet
is empty.Clear
could be removed altogether, leaving the consumer to implement a for loop callingPop
if necessary.*Set
. This may seem heavy handed at first but since it's not necessary to explicitly take the pointer of aSet
variable to call*Set
methods this incurs no penalty on the consumer. If Immutable set type / frozenset #1 is implemented it would be a nice symmetry to have the mutable type use a pointer and the immutable type avoid it.The text was updated successfully, but these errors were encountered: