EDIT: This can be considered solved. Or rather, change that to a request for a documentation update.
Is there a good reason why imports have to be done at the very beginning of the program?
I mean it's not like BlitzMax compiler is done in one pass or anything.
I can reference in my code functions or types declared later on, but I can't add an import at the point where I actually need it???
Quite frankly this is getting on my nerves.
This is all the more annoying that building modules has been regarded as something for "advanced" programmers (even if there's not much to it), in that it doesn't come out of the box (requires to install MINGW on windows).
Those that want to code out of the box and not bother with building modules just use includes instead.
But these includes *cannot* do the import they require, or else the compiler complains that an import must be done at the start of the program. You'll then have to let the main program do the import for you (oh god, that's modular programming...) or make it a module just to satisfy the compiler.
And let's be clear, even "advanced" programmers are not always willing to make a module out of a twenty lines long code snippet, seriously.
So the question is:
is there any rationale behind this?
Given that even a stupid preprocessor could do the trick (moving all the imports at the very beginning), I doubt it, but I may be biased.
Can we remotely hope a change in this behaviour?
As a bonus question : am I alone worrying about this?
Thanks.
Is there a good reason why imports have to be done at the very beginning of the program?
I mean it's not like BlitzMax compiler is done in one pass or anything.
I can reference in my code functions or types declared later on, but I can't add an import at the point where I actually need it???
Quite frankly this is getting on my nerves.
This is all the more annoying that building modules has been regarded as something for "advanced" programmers (even if there's not much to it), in that it doesn't come out of the box (requires to install MINGW on windows).
Those that want to code out of the box and not bother with building modules just use includes instead.
But these includes *cannot* do the import they require, or else the compiler complains that an import must be done at the start of the program. You'll then have to let the main program do the import for you (oh god, that's modular programming...) or make it a module just to satisfy the compiler.
And let's be clear, even "advanced" programmers are not always willing to make a module out of a twenty lines long code snippet, seriously.
So the question is:
is there any rationale behind this?
Given that even a stupid preprocessor could do the trick (moving all the imports at the very beginning), I doubt it, but I may be biased.
Can we remotely hope a change in this behaviour?
As a bonus question : am I alone worrying about this?
Thanks.