On Apr 27, 11 21:37, Alexander wrote:
On 27.04.2011 15:15, Steven Schveighoffer wrote:

You can use clear to call the destructor of a class, and then GC.free (if you 
wish) to free the memory.

   BTW, why it is called clear()? To me, clearing something is not destruction. 
For instance, some buffer object may be cleared to empty the buffer, so the 
action of clear() is counter-intuitive, IMHO.

/Alexander

Because Andrei chose to call it clear() :)

Well according to http://www.digitalmars.com/d/archives/digitalmars/D/clear_97688.html, because the function "clears the state of
an object.".

I'd rather it called destroy(), or when 'delete' is no longer a keyword, delete(), as .clear() is a container method for a different action (http://www.digitalmars.com/d/archives/digitalmars/D/Meaning_of_.clear_for_containers_126094.html).

Reply via email to