> I want my clients to be able to take objects of some opaque record type that I've defined, and put them entirely on the stack
if you want to put the object on the stack, the compiler has to know the size of the object to reserve enough space on the stack. How can it know the size of the object if it does not have its full definition somewhere ?
Module symbol table for example, where only the compiler can actually see the complete information about a type, although the consumer code can only access what is exposed as public.
This is fine if you can recompile a program against a new version of the library, but if you just want to relink it doesn't work well. This is actually while common when a .so is replaced with a newer version in a system without rebulding the world.
Some languages have, like ADA I think, have first class support for runtime sized, stack allocated types, so it might work there.
if you want to put the object on the stack, the compiler has to know the size of the object to reserve enough space on the stack. How can it know the size of the object if it does not have its full definition somewhere ?