dtype_dispatch: a most beautiful hack
I've created a monster: a macro that defines two more macros that define enums and match them.
But it's saved me about 1000 lines of code, and the more I think about it, the more convinced I am it's the right solution.
I reckon it could be useful for various other numerical and dataframe libraries too, e.g. Polars.
The library is dtype_dispatch, but let's start with the story.
About 3.5 years ago, I started working on PancakeDB.
This involved generic (specialized) code over data types, like i32,...
Read more at graphallthethings.com