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

Would a factory be able to achieve this? Keep a reference to everything it had constructed?

For your own classes/types and factory for every other class that you can in “client” code, yes. But harder or impossible with most languages for builtin types that you don’t instantiate directly.

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