<- Back | Index | Forward ->
Classes
The toolkit implements an object model but presents it though a
non-OO API. Daylight must do their own:
- type checks, at run-time,
- method dispatch and polymorphism,
- error management
The run-time tests are needed to prevent:
dt_getrole(reaction, mol); /* parameters swapped */
Compare that to a more OO approach:
mol.getrole(reaction) # fails: molecules don't have
# a "getrole" method
reaction.getrole(obj) # while a reaction does
Using a more modern language gives us those capabilities "for free"
because they are built into the language.
- C++ can do the first two items at compile time,
- The C interface could have additional type safety
- Lose polymorphism, eg, for dt_aromatic and dt_stringvalue