Odd Import/Include

BlitzMax Forums/BlitzMax Programming/Odd Import/Include

Chroma(Posted 2007) [#1]
I wondered what the difference was between Import and Include. Now I know. Imported files don't have access to declared Globals in the main .bmx file. /bonk

EDIT: This probably should have gone in General Discussion in hindsight.


Picklesworth(Posted 2007) [#2]
Yep, Imports can be thought of pretty much as their own independent programs, except very easy to link in to your own.


H&K(Posted 2007) [#3]
Imports are generaly "PreCompiled", this dosent mean that thay always are, but the fact that they can be is the main difference.

This means for example, as you said the import cannot know of any of the Globals in your main program. (Because they are already compiled ;).
Or they can have super/superstrict in them, (Cos..... etc), and it was the first command in that compile

Includes on the other hand is just the same as "Cut and paste", so you cannot have super/superstrict in them, and they know of globals in your main program, cos they are in your main program.


Blueapples(Posted 2007) [#4]
Import specifies that a file should be linked in to the main executable. This explains why it can either be a BMX file or a precompiled library. Reading up on linkers and static libraries should help anyone who wants to know more about how this works.


Chroma(Posted 2007) [#5]
A lot of new things were introduced in BMax, Blueapples. Even us veteran Blitz users are having to wrap our heads around some new concepts.


Dreamora(Posted 2007) [#6]
As old Blitz user you will have more problems than users from languages like C# as it is definitely more like modern programming language than like 1980 pascal code and compiler behaviors the old blitz used.


Chroma(Posted 2007) [#7]
Yes, it's a tad more complex than basic but hardly rocket science. I do have C++ and vbasic books laying around somewhere. I flip thru them when absolutely required. ;)


Blueapples(Posted 2007) [#8]
The perceived complexity of BMax does kind of worry me a bit. I mean, it's still very nice in that there is a lot of stuff under the surface which you can totally ignore unless you need to go into depth with the language. One thing I liked about Blitz3D so many years ago when I played with it for the first time was that everything just sort of works. BMax has that same feel, but what worries me is that since it is a lot more powerful, some prospective users might be scared off.

On the other hand, whereas Blitz3D was too domain specific for me to purchase, I bought BMax just about as soon as I read about it (and could afford it, no job back then) because it has a nice balanced set of functions, with all this great stuff going on underneath. Over all, I greatly prefer the language to Delphi, VB, C++, and I could go on, just because it's basically BASIC + C, which is perfect.

I've had a lot of experience with lots of languages, and for just about any purpose, if you can find a library that works, BMax is the way to go.

Cross platform doesn't hurt either.


Chroma(Posted 2007) [#9]
/nod


Picklesworth(Posted 2007) [#10]
I haven't found BMax complex in the slightest, and I only really started with it after ages of being too busy / tired / lazy for programming :)
The language has some advanced features, but they are some of the easiest implementations of those features I have seen. (Function pointers, for example, are great).
It doesn't have to be all at once, either; it's just a very big collection of tools that you can explore for as long as you want and never get bored.


Chroma(Posted 2007) [#11]
So, some are confusing feature-rich with complexity. Interesting...


Blueapples(Posted 2007) [#12]
All I'm saying is that it isn't a scripting language, and it isn't just procedural. There are people who can't handle that, and that's fine because they can still use BMax. For me, it's great that it has a real implementation of all the simple to use features that I can tweak and look at.

I guess my point is that BMax is closer than any other language I've seen to being "all things to all people". Simple to start, full featured for when you get more advanced. I mean a basic that can directly link against C and C++? That's just awesome.