It’s interesting to compare this approach to something like QuickSort() to what eventually landed as sort.Slice() in terms of getting a mostly type safe function to work in a generic algorithm.
One direction generator tools have persued is replacing meta variable markers in source code with concrete types using go generate; but I wonder if one could write a generator that takes a Ty-based runtime polymorphic function and replaces all usages of it with a concrete implementation C++ template style, allowing the code to function correctly before and after transformation.
It’s interesting to compare this approach to something like QuickSort() to what eventually landed as sort.Slice() in terms of getting a mostly type safe function to work in a generic algorithm.
I’ve experimented with a (toy?) metaprogramming system for Golang and run into a few places where the Ty package would save me a lot of work.
One direction generator tools have persued is replacing meta variable markers in source code with concrete types using
go generate
; but I wonder if one could write a generator that takes a Ty-based runtime polymorphic function and replaces all usages of it with a concrete implementation C++ template style, allowing the code to function correctly before and after transformation.