Boost logo

Boost :

Subject: Re: [boost] Formal Review Request: TypeErasure
From: Simonson, Lucanus J (lucanus.j.simonson_at_[hidden])
Date: 2012-06-06 18:11:18


>> * people shouldn't use any to replace classic interfaces and virtual
>> functions

>Excuse me, but why not? Doing polymorphism this way eliminates all kinds of nastiness that we get with classic interfaces and virtual functions.

Perhaps we should make sure the documentation clearly states what kinds of nastiness the library allows us to avoid and how it is intended to be used. It solves a lot of problems. We should explain what they are and why using the library to define interfaces is an improvement on past practice. For example, nastiness related to generic programming can also be avoided. A template library with generic interfaces requires that the header only implementation of the implementation details of the library be pulled into every compilation unit that uses it. With the new any we can keep much of the goodness of the generic interfaces (type safety, etc.), but compile to a binary library with any based interfaces that can be linked to in a large application without needing to recompile every module that uses it every time the internal implementation of the library changes, just relink. Also, the source code of the library can be kept closed while only the any-based interfaces in a public header file are exposed to the library user. Yes, the extra abstraction comes at extra cost, but that cost is unavoidable if we are to solve the problem. The linker needs at least one indirection to be satisfied. Then, of course, we need to explain why it is better than just requiring the user to inherit from some base library type in typical OO style.

Regards,
Luke


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk