Using metaprogramming to dynamically generate on-planet functions