Open fluffyemily opened 6 years ago
Is this repetition that much of an issue today? My experience with macros is that their use tends towards eventually obfuscating what's going on, or at least making things a bit harder to read in the long run, especially when there's multiple moving parts/parameters. I have a feeling that regular statically typed code is in most cases preferable (but have no data to back this up).
I share that they make a lot of sense when there's extreme or simple repetition, but I didn't get that feeling when poking into the ffi code.
Currenty in our FFI we have a number of functions that essentially to do the same thing but accepting different types. This is to make the API profile easier for consuming clients. However this makes for a lot of repetition of code and causes a lot of work to occur if Mentat's API changes in these areas.
This issue tracks creating Macros for generating type specific FFI functions to avoid duplication of work. These macros should cover the following FFI functions.
value_at_index_into_<type>
typed_value_into_<type>
query_builder_bind_<type>
entity_builder_retract_<type>
entity_builder_add_<type>
in_progress_builder_retract_<type>
in_progress_builder_add_<type>