Open 9844201 opened 2 years ago
you need a C preprocessor
You could implement preprocessing in squirrel, too! Only the person feeding a script to the compiler truly knows how to find other referenced scripts. But it might be good if squirrel had a way to set #line and #file for producing debug data. Not that I'm suggesting it, just thinking out loud.
I though about it a number of time #include is propably not a good idea to be built in in the language. However #line and #file would be very useful for a DSL that spit out squirrel and wants to retain debugging.
I think the major issue is that the dubug information as is now, assumes 1 source file per SQFunction.
maybe allow #include only outside any class or function - or generally bracket closure? (The main problem why we implemented a workaround-include are ENUMs and constants, whereas constants at least have their consttable, ENUMs are bound to compilerruntime and hence just don't work across files at all - so we now can "include" them)
I like it so much How to use C language include "test.nut" similar function