codex-semantics-library/patricia-tree

`Dissappeared` exception is never caught

dlesbre opened this issue · 1 comments

When using WeakNode, pop_min_nonempty can raise a Disappeared exception. This exception is never caught...

Possible solutions:

  1. Export the exception and specify document which functions can raise it.
  2. Get rid of pop_min_nonempty and just have pop_minimum be recursive and return an option type (slight performance loss as the recursive case must now built/destruct options).
  3. Add a try catch to pop_minimum, but I feel this would lose the performance benefit of using pop_min_nonempty

I'm personally in favor of option 2, @mlemerre thoughts ?

Good catch. However, if a "Disappeared" situation occured, I think that we should retry finding the minimum from the start, and not juste return None. This is the "compact and retry" comment that I had left. I am not sure that this corresponds to what you mentionned in 2...