ACCU Home page ACCU Conference Page ACCU 2017 Conference Registration Page
Search Contact us ACCU at Flickr ACCU at GitHib ACCU at Google+ ACCU at Facebook ACCU at Linked-in ACCU at Twitter Skip Navigation

pinLetter To The Editor

Overload Journal #49 - Jun 2002 + Letters to the Editor   Author: Kevlin Henney


There was no mention in Overload 48 that my article, "Function Follows Form", was previously published online as part of the CUJ C++ Experts Forum online. The omission is not major, but it is worth pointing out that it appeared originally for November 2000 following the summer break after the untimely demise of C++ Report. Its prior publication is relevant because in the nearly two years since it was written - and much longer for the code and basic design - a couple of things, albeit minor, have changed in my thinking:

  1. I used the name 'function_ptr' to represent the zeroargument arbitrary function and function object adaptor with smart pointer semantics. I now prefer the name 'any_function', which is more in keeping with my use of the name 'any' for any arbitrary value, and the prefix 'any_' for other wrappers in a similar style, e.g. 'any_iterator' and 'any_string'.

  2. In the article I mentioned that the technique of using a nontemplated base class to provide uniform access to a common family of variations expressed as a derived class template was based on the External Polymorphism pattern. I was careful to ensure that I said "is based on" rather than "is" because at the time I was not comfortable that the pattern's intent was appropriate, even though its structure was. Well, following some tentative repetition of idea and the "three strikes and you're out" approach, I have decided that it is categorically not the right pattern to reference. To the best of my knowledge, the pattern has not been properly documented elsewhere, although it is used extensively. I plan to document the pattern more thoroughly at some point, either under the name Polymorphic Wrapper, which captures the fact that it converts one form of polymorphism (templating) to another (virtual functions), or as Parameterized Derived Class, a more accurate albeit prosaic name. Generally it preserves the degree of polymorphism, but reduces the compile-time polymorphism by one axis to introduce one of runtime polymorphism.

Overload Journal #49 - Jun 2002 + Letters to the Editor