Hacker News new | ask | show | jobs
by kgabis 4276 days ago
> Except it is not extendable.

Function pointers are a good way to achieve extensibility in such cases.

1 comments

You are basically doing a VMT implementation by hand.

I rather let the compiler do the work for me.

No, using function pointers does not necessarily mean implementing a vtable.
No, but it feels like it.

Oberon and Modula-3 only provide record extensions for OOP, with methods being done via function pointers.

In case you aren't familiar with these languages, here is some info.

http://www.inf.ethz.ch/personal/wirth/ProgInOberon.pdf (Chapter 23)

http://en.wikipedia.org/wiki/Modula-3#Object_Oriented

In Oberon's case, which was lucky to have survived longer at ETHZ than Modula-3 did at DEC/Olivetti, all successors (Oberon-2, Active Oberon, Component Pascal, Zonnon) ended up adding support for method declarations.