Search code examples
language-agnosticclassprojectsstruct

Is it reasonable to have more than 65536 User Defined Types in large projects?


I'm thinking about some stuff related to runtime type info, and I'd like some feedback from programmers who work on much larger projects than I do. Is it at all reasonable to expect any program to ever have more than 65536 (2^16) user-defined types (classes and structs) in a single project? This does not mean 65536 instances, it means 65536 types. Would it matter at all in practice if a compiler limited you to 65536 classes/structs in any one project?


Solution

  • No, because at that point you should be strongly decoupling projects. Only the 'public-facing' types need to interact with each other across projects. Then the limitation becomes: maximum of 2^16 types per project, and maximum of 2^16 public-facing types across all projects.