I would encourage anybody to create blog-post-like content and add it in the website so that with time we can have a larger body of knowledge of practical tasks and problem-solving topics.
Same here. Though to be fair, Ada’s approach to the whole OO topic is more refined than most languages. Ada does not have OO built in (such as a class keywords). I has tagged types, it has packages (for the private/public split), normal types can have quite a strong level of inheritance (type .. is new and subtypes). So you can get some of the OO functionality without having to go full into the OO paradigm
I was thinking about showing how to do it without OOP.
No, Ada has as orthogonal and separate features every single one of OOP’s “four pillars” — you don’t have to “buy into” OOP unless you need dynamic dispatch.
No, you cannot. You can of course return a vector of entry points. This is how OSes implement drivers. What you cannot do is to keep your ugly variant records. You just do not know upfront all cases = derived types. So, your solution would be necessarily untyped as it would need an equivalent of void * (e.g. System.Address) to refer to the opaque variants = instances.
What people refuse to understand about Ada’s OO type system is that it is just a language level method to describe things you do anyway daily, but in a far more type safe and maintainable manner.
Actually all types should have been tagged either with an internal or an external tag. Alas, multiple dispatch is an unresolved problem still.
Blatantly incorrect.
You can obviously do the implementation of a plug-in without resorting to either OOP or the dependency of System.Address — all the “pure C” DLLs prove the former, as there is no dispatching in C, and the structuring/usage of DLLs w/o System.Address prove the latter.
All you really need is a way to load/execute and a well defined interface. — Hell, you could do plug-ins as INI-files with the “function” as the section, and the key-value pair as the instructions to execute, as a sort of psudeo-script thing.
C DLLs use void * for data objects, which is the point. Dispatching happens when the vector is selected. Vectorized library calls = dispatching.
Think it over again. You have a variant record of alternatives representing a polymorphic object (T’Class). Annotate each alternative with a type T1, T2, .. Tn, these are members of the class. Add a new alternative Tn+1 from a plug-in. Return a variant record of. Can you? Plug-in or not you cannot.
In a monolithic design you can go back to the drawing board, change the declaration of the variant record, recompile everything, patch all client code case statements, review all client code that has if statements rather than case. Have fun! But with a plug-in you have no way to do even that. It is too late.