Sharing the memory space between executed aime programs has appeared as an incidental featured and it may not yet work without a glitch, not that there currently exist known issues. It has many use limitations and it requires extra effort in the aime interpreter integration.
Sharing the memory space allows programs to interact in a multithreaded like fashion. Still, since the programs access the same set of executive objects they can’t be executed from different threads.
Not much seems to be required at the first glance to share data between programs, except for sharing the executive, in particular the memory allocator.
Programs sharing the memory space do not share the function and variable name spaces. Also, the aime procedural syntax does not allow globally visible variable declarations.
One way to effectively share data is via global variables introduced (defined) by the application. They may be of any type, including library types like the libaime data structure types. Objects of the latter type may be created, operated and destroyed via data type interfaces exported by their respective library objects.
Sharing the memory space allows programs to inspect and modify data created by other programs. Unlike threads, the programs sharing a memory space do not share the source and they may start execution (they may even be written) at different times.
Programs may call functions introduced in other programs, provided they can get a grab on them. One way to share function definitions is via function pointers recorded in shared data structures.
See Function Pointers.
Functions may even be added to running programs, by recording them in the shared data space. The programs to which the function definitions belong may even stop execution and the function definitions would still be available. The magic is made possible by the aime function definitions being fully referable objects that observe the larger libaime object management semantics.
The execution of programs sharing the memory space may be interwoven, by doing it step by step.
The full set of executive objects, including the memory allocator, the library objects, etc, should/needs to be shared. The application allowing memory space sharing will make sure objects like the function type mapper is shared.
Memory space sharing is not an aime language feature and is not made possible by any libaime library object. It is an application feature and the application code will specify it.
Procedural and non procedural programs can’t share the same memory space, as the latter have no concept of aime functions. The obvious risk is that code coming from a non procedural program will try to execute a function defined by a procedural program. It is up to the application to keep the two classes separated.