Re:Rich Hickey on Functors in C++ (1994)
by ScottBurson on Tuesday July 17, 2012 @02:43PM
(#4257172)
The right thing is what is here being called a "bound pointer". It is actually the correct implementation of a closure: a code pointer paired with a data pointer, where only the code in question needs to know the type of the data pointer.
I proposed it to Stroustrup et al. in 1992, but was ignored.
I don't recall their rationale for rejecting it, but I think time has borne me out.
I know from D&E that the C++ committee has a policy of only accepting new features which had an existing implementation and first-hand accounts of using the feature.
There was existing implementation in 90s, bound pointers were implemented in Borland C++ Builder (__closure keyword).
Then I think it's fair to assume the above poster was not the only person to propose it.
Re:Rich Hickey on Functors in C++ (1994)
by ScottBurson on Wednesday July 18, 2012 @01:27AM
(#4259494)
I probably wasn't the only one proposing it, but I have no way to know who else might have done so.
Even Hickey states in this article that the term comes from James Coplien. His C++ book from 1992 was what first introduced me to the concept.
Also, while I am sure they were for the time a near-optimal solution, they are f'ing gross, so "Hickey functor" is a bit of an epithet. "Oh well, better than Hickey functors" was a justification for a lot of Gang-of-four pattern goop in my C++ code.