Massively informative! Very many thanks. I would love to see more knowledge dumps like this of the inner workings of the engine for people like myself who are interested, but not able to invest the time to digging into the source to find these things out on their own.
So... How does 'forward linking' look as a potential enhancement?
This also clarifies exactly what is happening when you try to import the same object in multiple header files and why that causes a duplication problem. If I understand correctly you end up with something like this:
Code: ags
Code: ags
Code: ags
(Header copy step takes place in compilation)
Code: ags
So... How does 'forward linking' look as a potential enhancement?

This also clarifies exactly what is happening when you try to import the same object in multiple header files and why that causes a duplication problem. If I understand correctly you end up with something like this:
// Scrip1.ash
import function foo();
// Script2.ash
import function foo();
// Script3.ash
import function foo();
(Header copy step takes place in compilation)
// Script3.asc ends up looking like this:
import function foo();
import function foo(); // Error!
import function foo(); // Error!!