There’s something about Julia style that I’m just not getting. Let’s say I want a Curve type for a curve in the complex plane. It’s meant to be abstract, since I will have different subtypes of Curve (Line, Circle, etc). But all objects of Curve type should have a
pos field that gives the position z as a function of a parameter. This is all that’s needed for a lot of Curve functionality.
In a purer OOP language I’d have Curve as an abstract class that has a
pos property and methods that work on all Curves. All those methods know that the object has a
pos property, even though the class is abstract.
In Julia, if I have an abstract
Curve type and methods that operate on all
Curves, those methods will need to use the
pos property. Every concrete subtype of
Curve then has to be responsible for declaring a
pos property, rather than having it be guaranteed as part of
Curve. That’s a recipe for mayhem.
Essentially I’m looking for the concept of an interface. What is the Julia equivalent? Or does Julia have another way to look at this?