Another way to address both in one addition is to have a new 2-body template (I 
called this `editOrInit` in 
[adix/lptabz.nim](https://github.com/c-blake/adix/blob/master/adix/lptabz.nim#L574))
 that just has a user-given body for both the found & missing branches with no 
exceptions. Example use might be 
[inc](https://github.com/c-blake/adix/blob/master/adix/lptabz.nim#L1048).

On the one hand, users do have to know the `do:` notation for the 2nd body at 
call sites. OTOH, this is both general & more backward compatible than a proc 
-> template switch (where the symbol no longer has a run-time address). There 
could be a non-var overload for just the `getOrFail` case. { Besides 
exceptions, Option[T], and a more vanilla return code people might come up with 
some other failure protocol. }

Reply via email to