Okay, I've managed to squeeze all the enjoyment that I can get out of rewriting this Dynamic code, which I'm sure is more enjoyment than most people could get. It's not totally the way I'd like it, but it's close enough. Let's see what I need to do next:
- Pull the functions into a new module to avoid import cycles when I update the return types.
- Write the code for hopefully the last general abstraction.
- Write types to simplify writing decorators, because I have to rewrite an existing decorator anyway, because it should be using the code from the previous step.
- Rewrite that decorator.
At this point, the typing errors should force everything into using the last abstraction, and I can make sure the ergonomics look reasonable, and then finally write some tests for this stuff.
At the moment, I need to take some time to cool off.