On 12/01/2018 23:12, Chris Vine wrote:
> On Fri, 12 Jan 2018 22:45:36 +0000
> Mr Flibble <
flibbleREM...@i42.co.uk> wrote:
>> On 12/01/2018 21:54, Chris Vine wrote:
>>> On Fri, 12 Jan 2018 19:42:24 +0000
>>> Mr Flibble <
flibbleREM...@i42.co.uk> wrote:
>>>> Some classic (GoF) design patterns are no longer needed in C++.
>>>>
>>>> Lambdas wrapped by std::function, for example, can be used instead
>>>> of the "command" pattern.
>>>
>>> You were arguing against this some years ago when I suggested
>>> something similar (although I was slightly more nuanced - see
>>> below). You were in pretty much full-on OO/inheritance mode then as
>>> I recall.
>>
>> I do not recall this at all. Maybe you are confusing me with someone
>> else?
>
> I don't think so. You were not impressed by the idea of replacing the
> polymorphic behaviour of virtual functions with inheritance by
> std::function in order to implement GoF abstractions, and described your
> OO credentials by reference to your role in bringing to market one of
> the first mobile phones, for Siemens if I recall it correctly. I think
> I described you as a 1990s OO dinosaur, or something like that.
I was on the team that made the first smartphone but it wasn't Siemens
and I would never "describe my OO credentials" in relation to that role
as OO is but one tool in the toolbox so I still think you are confusing
me with somebody else.
It is certainly the case that I wouldn't have used std::function when
working on that project as Boost wasn't available to us at the time for
various reasons so we couldn't have used Boost.bind however that was a
long time ago and I have been using "modern" C++ techniques for a
considerable time since and I have been using std::function since TR1
support was added to the stdlib implementations I use.
>
> If you weren't involved in Siemens mobile phones then I have got the
> wrong person.
Maybe you are confusing two different people as one person.
"OO-style" (that terminology is awful btw) inheritance does NOT require
allocation on the free store; all it requires is storage into which an
allocation can be made and that can be on the free store, the stack or
from a static storage duration memory pool.
>
> If your point is that you can use a fancy allocator for this (say, a
> specially designed small object allocator) when using the abstract
> class/inheritance approach but not when using std::function, then you
> may have a point. Dunno.
What you call a "fancy allocator" I just call a (custom) allocator;
nothing "fancy" about it.