Earlier quoted context omitted.
Yes - and for each of these examples, there would likely be still a single "object instance" managing these devices (e.g. "Display" module). Or two entirely different modules ("Headset" module + "Screen" module), again each having only a single "instance". The concept of instancing is inappropriate to most situations. The things that we have more than one ("dynamically many") instances from are typically dead data, b…
> The concept of instancing is inappropriate to most situations. At the application level, maybe. At the library level, this can easily kill reuse. See Lex/Yacc. They used to assume a program would only have one parser. Then some naive developer tried to parse both JSON and Lua tables in the same program. Oops. Another example: standard libraries (including home grown ones). They instantiate everywhere: arrays, hash…
> arrays, hash tables, file descriptors
Most arrays / hashtables in my own use are actually static resources as well...
File descriptors, same thing. They are (or correspond to) a process-wide resource managed by the OS. Most maintainable way is to manage them in a global pool.