Well, I'm coding in Nim for the past week or so and I have to say that modules and 'import's is one of the most confusing aspects of the language. I adore its performance and flexibility, but on the other hand I've ended up packing up (almost) everything in one single module in order to avoid importing anything - for fear of having to deal with circular dependencies.
That being said, I decided to - at least - separate my type definitions.
So in module 'global.nim' I have the declaration of a type (ref object), and in my 'main.nim' I have a var of that particular type:
var
MainProgram {.exportc.} : StatementList
Stack : seq[Context]
SystemFunctions : Table[string,Function]
# Const/literal arguments
ConstStrings : Table[string,Argument]
ConstTrue : Argument
ConstFalse : Argument
ConstNull : Argument
and ... I'm getting undeclared identifier: error for all types defined in my other module (StatementList, Context, Function, Argument)...
What is going on? The thing is I need at least the type definitions visible from a different module. Any ideas for a workaround?
Also, how could I go about having super-global variables, without having to pass them around? (I mean a global variable set in one module, and visible from the rest of the modules)
Jesus! With so much moving-things-around, I forgot the asterisks...
Thanks a lot!