3 ms·
What does aliasing mean in this context?
by beezlewax 3y ago
What does aliasing mean in this context?
- pkolaczk 3y agoIf you want to reuse an object to avoid allocation, you better not have a reference to that object from somewhere else. In JS AFAIK there is no way to detect such situation automatically.
- Etheryte 3y agoYes there is, it's called scope and it's super easy to keep track of? In fact, you have to go out of your way to share a reference if you scope it.
- pkolaczk 3y agoIn languages like JS, Java, Python is trivial to accidentally make an object escape the scope by storing a reference in a field of another object that outlives the scope. And it can be another developer 3 months later that can introduce a bug, not knowing about your clever object reuse.