In my daily life and while reading books I've seen the term destructor as well as deconstructor.
But what is the correct name for this method?
In my daily life and while reading books I've seen the term destructor as well as deconstructor.
But what is the correct name for this method?
"Destructor" is indeed the correct term. I have seen "deconstructor" in older books, and it appears that there was debate for a while over the correct term, but destructor appears to have won out.
As for the flippant answers about what wiki or WoW says about deconstruction: try looking up "destructor" in a standard dictionary. Apparently, it's a device for destroying an off-course airborne missile or launch vehicle.
Destruct = Destroy
Deconstruct = Decompose (Reverse compose into pieces)
Put -tor then it's the executer of the verb. So it's depend on the context you trying to achieve.
I still remember the lecture that introduced concepts in Haskell when I first heard of the word "deconstructor". I first was confused because I thought of destructors but as it quickly turned out, they are different concepts. Haskell has no destructors but deconstructors. They are used to retrieve single data member fields that a structured value contains. They are basically member accessors but as functions.
I actually wondered about the word because I practically never found it elsewhere. Here I found an answer:
Decomposer oder destructuring could be a good equivalent term and "destructuring" really is something that I commonly have heard of.