Closed Anders429 closed 3 years ago
Dropping this, as it is superseded by the progress in #37. Static construction at the const of mutability is a good tradeoff. Most users won't want to mutate after construction anyway, and this allows construction to be done at compile time, which is great considering that construction has high temporal complexity.
As it stands now,
WordFilter
is an immutable structure, only being created once and statically the same forever after.There is a possibility of allowing
WordFilter
s to be mutated after creation. New matches and exceptions could be added onto root after having all current aliases applied to them. New aliases could be applied onto root and other aliases (and merged aliases could be created from them and applied similarly). New separators could be added to the separator root node. Even newOptions
could be provided, as each option is only used at query time. Ultimately, all of these things could combine to support amerge
method, merging twoWordFilter
s, although the semantics for handlingOptions
in that case is unclear.Removal may also be supportable, although much more complicated. Removing words and exceptions would involve traversing the tree and unsetting the node. Removing an alias or separator would be similar, simply removing the
Return
node.This approach will support the use of standardized
WordFilter
implementations, allowing users the ability to modify them to their liking.