|
|
|
|
|
by Joker_vD
88 days ago
|
|
I don't think that's the scenario the other commenter was talking about: > there is no centralized monomorphization. If an application uses two libraries, each of which handles lists of int, each library will have to independently macro-generate its separate list implementation, and because C's type system is nominal, the generated types will be isomorphic but incompatible. So, lib_a.c includes header_only_list.h, and lib_b.c also includes the same header_only_list.h, but they can't they pass the list structures between each other because those structs would be incompatible even though they're textually identical ("the generated types will be isomorphic but incompatible"). To which I replied that no, they would not, no C program would be able to work if this were true. Otherwise, the mentioning of monomorphization doesn't make any sense: of course two completely different implementations of lists will be incompatible. |
|