DIP74 - where is at?
Jonathan M Davis via Digitalmars-d
digitalmars-d at puremagic.com
Sun Oct 11 14:26:14 PDT 2015
On Sunday, 11 October 2015 at 07:55:08 UTC, Manu wrote:
> Sure. If you don't care, I'm sure it's fine. But I don't feel
> it's reasonable to say C++ has ref counting. You might as well
> say "C++ has garbage collection" (which is probably actually
> more true than this) ;) ... Objective-C supports ref counting.
Reference counting is now part of C++'s standard library. They
may not have the kind of reference counting that you want, but
they support reference counting as part of the C++ standard.
And certainly for my use cases, having wrapper classes like
smart_ptr has worked fantastically. Any performance hit that
might be incurred be extraneous increments and decrements is
dwarfed by everything else that the program is doing. And I think
that it's pretty clear that the same is true for a _lot_ of
programs.
I can certainly believe that it's not true for the kind of
programs that you write, and if we can better support those
environments, great. But most programmers don't program in a
world where it normally matters whether a couple of extra math
operations are done or whether a function call is virtual or not.
It matters in certain areas of the program but not in general. We
don't want to be doing unnecessary operations, and efficiency in
other areas can have a huge impact on our programs, but I think
that it's quite clear that you live in a world that cares way
more about every little ounce of efficiency than most programmers
do.
So, I think that it's a huge stretch to say that C++ doesn't have
ref-counting or that it doesn't work - or even that a similar
solution in D wouldn't work. It would work for many people. If we
can come up with one that better supports your use cases, then
great. As long as the cost elsewhere isn't too high, why not? But
that doesn't mean that a solution like smart_ptr isn't a
fantastic one for many of us.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list