Uh... destructors?
Stewart Gordon
smjg_1998 at yahoo.com
Tue Feb 22 16:14:38 PST 2011
On 22/02/2011 06:08, %u wrote:
<snip>
> - synchronized is meaningless since there's only one thread ever running the destructor anyway
As such, destructors are vacuously synchronized. At least, if you don't have a collision
between threads that try to delete the same object at the same time, but that would
indicate a bug in the program anyway.
> - private makes no sense since (unless we're trying to imitate C++ here) destructors are only
> called from the runtime, and nowhere else.
> - The only meaningful attribute there is extern(C).
In what way is extern(C) meaningful for a destructor?
> I would agree that DMD should ignore the attributes that are redundant or optional (e.g. it should
> be okay for "static" to be written and/or omitted at the module-level, and DMD should ignore it)
> but I don't see why _wrong_ attributes should be ignored... it confuses the programmer, opens the
> potential for error, and doesn't have any benefits.
I entirely agree. It's been discussed quite a bit:
http://d.puremagic.com/issues/show_bug.cgi?id=3118
> (The only exception I can think of to this rule
> would be attributes that cannot be removed, like saying "private:" in the beginning... for general
> attributes like those, I guess DMD can ignore them, but for specifically written attributes like
> these, is there any benefit whatsoever to allowing them?)
No.
Stewart.
More information about the Digitalmars-d
mailing list