On 30-05-2012 08:43, Jonathan M Davis wrote:
On Friday, May 25, 2012 15:04:16 Alex Rønne Petersen wrote:
So I was writing a container class and in some test code, I called
container.clear(). Reasonable enough, right? Hell, it even compiled!

Turns out, my program completely broke at runtime. Apparently, I'd
forgotten to implement clear() on my container class, and
*object.clear() was being called instead*.

I don't blame UFCS for this. It just happened to be the reason this
compiled at all. But, what I do think is: clear is the *ABSOLUTELY MOST
HORRIBLE NAME EVER* for a function that actually finalizes and zeroes an
object. Did it not seem obvious to call it, I don't know, *finalize*?
And even ignoring the naming, having a symbol called clear in the
'global' namespace is absolute insanity.

Am I the only person with this opinion?

https://github.com/D-Programming-Language/druntime/pull/231

Thanks!

--
Alex Rønne Petersen
a...@lycus.org
http://lycus.org

Reply via email to