Open x37v opened 3 years ago
The reason that dspsetup
was required to do this way is that we must have that method regardless of whether the object author creates/overrides it. In most other cases, if the user doesn't create it then nothing is needed at all.
However, having a way to define methods that are type-safe, leverage IDE auto-completion, and provide proper documentation about arguments is highly preferable.
For example, the means of delivering mouse events in UI objects and also the way notifications pass arguments are both currently suffering from some amount of trying to make every-differently-shaped-peg fit into a round hole.
I had a similar thought while poking around in the min-lib a while ago and decided to write a small proof-of-concept library myself.
It uses some scary preprocessor constructs and even more scary cxx17 template magic like compile time type introspection and if constexpr
-stuff to find special methods defined on the users class and resolve calls from the external wrapper to these at compile time, with type-safety on the users side.
If don't think the approach is one that is realistic for the min-lib but if you find it interesting anyways please have a look at the library and some examples.
I'm wondering if it might make sense to somehow make some of the messaging more type safe.
For instance, the
dspsetup
anddspstate
messages could be virtual methods for the vector and sample dsp classes. These methods would have the actual signature of the args they expect instead of an atom list.