On Mon, 12 Sep 2011 07:12:19 -0400, Michel Fortin
<[email protected]> wrote:
On 2011-09-11 10:23:21 +0000, "Marco Leise" <[email protected]> said:
Enough sarcasm. If I recall, Andrei liked the name 'clear' and was
unsympathetic to the arguments that it'd be confusing. 'clear' is
explained in TDPL and Andrei doesn't like to break his book, so we might
be stuck with that mess for while. But I think it's clear by now that
that 'clear' is confusing and dangerous: it will work with certain types
and completely blow up with others depending on implementation details
of the type (calling the destructor twice, it's insane!). And the name
just make it sounds like it's something pretty normal to do, which is
probably the worse part of it. Actually no, the worse part is probably
that it's inside module 'object', the only module imported by default
everywhere, so you can't even escape the confusion by not importing its
module. :-(
While I share your sentiment that clear is too useful a term to be
relegated to only be "call the destructor" (in fact, I use clear as a
member function in my dcollections library, which probably adds to the
confusion), I still think that the function should work. What types does
it "blow up" on? What types does it call the destructor twice? I'd like
to fix these.
-Steve