I kind of see what you mean now, I've been giving it some thought and this is what I came up with.
Here's my dynamic object definition code:
The memory_address value stores the address of some object type defined by a struct. All those object types need to have data members and methods (function pointers) added to them at runtime, without predeclaring them. Here's an example:
int memory_address; /* stores the memory address of the current object, accessed/mutated via assembly */
int type; /* stores the type of the object, this may be removed as it might not be needed */
This will be the base of all objects, built in types will have the linked_list_of_object_addresses filled in with some data members and methods before the program starts. Here's a function that would add a data member if it's not already in the list:
I know it's pseudocode but the idea would work right?
int append(object &a, object &b) /* a is the object to append to, b is the object to append */
for(int i = 0; i < len(*a); i++) /* len returns the length of linked_list_of_object_addresses */
if(b = (*a)[i])