Hacker News new | past | comments | ask | show | jobs | submit login

There is no way to tell if there is an index to the object or not, so obviously it’s lifetime has to be managed manually.



Indexes aren't references to objects, they're references to slots. The lifetimes of the objects are determined by whoever puts them into and out of those slots. That doesn't have to be determined manually.

Sure, objects aren't deallocated when the index is dropped, but that doesn't mean it isn't being automatically deallocated somewhere else for some other reason.


Wherever the object is deallocted, it can’t be done safely via the language or languages runtime because those indices are completely opaque. I’m not saying this is a bad thing, it definitely has a use case, but just that it isn’t really showing off a viable alternative to GC, it is very weird to be states as such. All manual memory management schemes work as you describe, they aren’t classes as automatic because the language runtime (or standard libs) can’t provide it for free.




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

Search: