Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

dead branches and loose leaves are connected to a real tree in the same way that dead code is connected to the program in a file. if you break off the dead branch, nothing happens to the tree, just like when you remove unused code, nothing happens to the program.


> if you break of the dead branch, nothing happens to the tree, just like when you remove unused code, nothing happens to the program.

Indeed, and this has been known since the 80s as dead code elimination. So why are we using a new, less descriptive, more confusing term again?


Language and terminology evolve over time. It can be uncomfortable and challenging to adapt.

Some new developers might be introduced to the concept initially as "tree-shaking". It's not wrong; it just differs from your preference.


I learned of tree shaking first, and DCE is clearly superior as a term: 1) it's actually descriptive, 2) there's a large literature using this term to look for further information, and 3) as the original poster noted, it's not actually a misnomer. There is literally no advantage to the new term that I can think of.


DCE is too general.

Tree-shaking is specifically the form of DCE where you remove unreferenced functions/modules.

Especially important is that you can do tree-shaking without analyzing control flow, while by default "DCE" implies you're analyzing control flow.

And I don't think tree-shaking is a misnomer. Depending on how you visualize the metaphor, unreferenced functions are either barely attached or not attached. Shaking them off is simple and sufficiently realistic.


IDK why language evolves.

It's more succient I suppose




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: