On 10/30/10 2:24 CDT, Don wrote:
Andrei Alexandrescu wrote:
If anything, I'm inclined to say that we assume that the postblit is
O(1) and
let the programmer worry about any inefficiencies. We can point out
that anything
worse that O(1) will be a performance problem, but it seems to me
that any
attempt to either accomodate arbitrary cost postblit constructors or
to try and
use any kind of scheme which forces programmers to write postblits in
a certain
way is too complicated and doomed to failure. And even if it works,
it will be
highly annoying to deal with.
It sure is annoying, but it does work.
Don, can you estimate how difficult it would be to convert BigInt to a
refcounted implementation?
At the moment, I think it's impossible.
Has anyone succesfully implemented refcounting in D? As long as bug 3516
(Destructor not called on temporaries) remains open, it doesn't seem to
be possible.
Is that the only blocker, or are there others?
I managed to define and use RefCounted in Phobos. File also uses
hand-made reference counting. I think RefCounted is a pretty good
abstraction (unless it hits the bug you mentioned.)
Andrei