Get the latest tech news
Dtype_dispatch: a macro that defines macros that define enums and match them
dtype_dispatch: a most beautiful hack - Graph All The Things, a math blog by Martin Loncaric
Eventually I closed shop on PancakeDB (entirely because of the match clauses, of course), but I would occasionally still encounter this problem while writing dynamically-typed FFI libraries for Pcodec. I found some unsatisfactory tricks to reduce boilerplate, using true dynamic dispatch with Box<dyn ...> in places and lousy macros in others, but it was still a pain. And ~2 months ago I decided to use dynamic types internally to Pcodec (to support new features and also reduce binary size (each unnecessarily specialized function is duplicated several times in the machine code, you know)).
Or read this on Hacker News