I need some help defining an interface that would kind of be a static class method in an OO language (while also having concrete instances of the contextual class with functionality in the class methods). For simplicity, let’s say I have a method, some context-defining types like Parabola
or Line
and a function like evaluate
where I want to define evaluate with something like this evaluate(Parabola, coefs::Vector{Number}, x::Number}) = coefs[1] * x^2 + coefs[2] * x + coefs[3]
and evaluate(Line, coefs::Vector{Number}, x::Number) = coefs[1] * x + coefs[2]
. I know this can easily be solved in this particular case another way, but it’s just an example of the behavior.
Note that the original poster on Slack cannot see your response here on Discourse. Consider transcribing the appropriate answer back to Slack, or pinging the poster here on Discourse so they can follow this thread.
(Original message ) (More Info)