"Björn Lundin" wrote in message news:mn8hok$fdf$1@dont-email.me... > On 2015-07-04 09:46, Simon Wright wrote: >> Shark8 writes: >> >>> Also, I seem to recall your dislike of INTERFACEs -- in hindsight, >>> what would you have done differently if you needed the mechanism of >>> "Type T has functions X, Y, and X" applied to a group of types? >>> Generics, or some variations thereof? >> >> Generic signature packages? >> > > I had this problem when implementing another companies proprietary > communications protocol, that we needed to communicate with. > The physical devices were picking-robots. > All messages had a common headers and then message specific fields. > And they had to have certain functions. To_String, Save_to_Database, > Send, etc. > > Since I had complete control over the implementation, I > ended up using inheritance from an abstract type. > > Some functions of the abstract type were implemented, > and others - to specialized for the inherited type - > was declared abstract. Right, with single inheritance. Good enough for 98% of problems, IMHO. I've used abstract types this way (in Claw and in Claw tools), but I found that the main gain was the shared implementations that could be provided by the abstract type. Interfaces don't allow them, so they provide cool-looking, but mainly useless capabilities. Randy.