Letter To The Editor

Letter To The Editor

By Kevlin Henney

Overload, 10(49):, June 2002


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.

Your Privacy

By clicking "Accept Non-Essential Cookies" you agree ACCU can store non-essential cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

Current Setting: Non-Essential Cookies REJECTED

By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED

Settings can be changed at any time from the Cookie Policy page.