3 ms·
You can make good arguments in either direction - either having a single generic type (a class) that fits all of these concepts, or having specific types for ea
by RyanZAG 13y ago
You can make good arguments in either direction - either having a single generic type (a class) that fits all of these concepts, or having specific types for each of those concepts.
Having just a generic type gives the language some useful simplicity as the single 'class' container can fulfill all of those needs yet not need the user to remember all the caveats of each specific type as the 'class' concept is generic enough to fit to almost anything.
Having specific types is very good for teaching the different concepts at a higher level as well as documenting what is intended for future readers of the code (as long as they also understand all of the concepts involved). Convention over configuration, really.
I personally prefer the more generic types as they don't try to lock you in to the authors specific biases and requirements - that's what frameworks are for.