I've always put my types in different files in blitzmax. It makes it much easier to work on a game when you might have more than 1 person working on something. What you seem to be alluding to is what the function of 'import' does. Including simply does a replace of that line with your actual code.
example:
- Files A,B,C,D all need MyType.
- MyType is in a different file called 'MyType.bmx'
- At the top of files A,B,C,D instead of 'include' I use import "MyType.bmx". It will compile MyType once and link that object file with each file that needs it.
For cyclic references I can't offer too much advice except trying to refactor to remove it (sometimes this is easier than trying to force it to work). Otherwise, if those two types are very tightly coupled, Then I would just put both in the same file and consider it a single 'module' that you have to import as a whole. I do this sometimes for large utility types that might use smaller helper-type classes to handle data.
example:
- Files A,B,C,D all need MyType.
- MyType is in a different file called 'MyType.bmx'
- At the top of files A,B,C,D instead of 'include' I use import "MyType.bmx". It will compile MyType once and link that object file with each file that needs it.
For cyclic references I can't offer too much advice except trying to refactor to remove it (sometimes this is easier than trying to force it to work). Otherwise, if those two types are very tightly coupled, Then I would just put both in the same file and consider it a single 'module' that you have to import as a whole. I do this sometimes for large utility types that might use smaller helper-type classes to handle data.