This seems very convoluted. Can't we just have some macros that define these methods at the C level?