Problem with Import

BlitzMax Forums/BlitzMax Programming/Problem with Import

Goodjee(Posted 2009) [#1]
Heyho, i want to do something like the following without "include", are there any possibilities?

a.bmx
import "b.bmx"
type A
  field zB:B
endtype

b.bmx
import "a.bmx"
type B
  field zA:A
endtype

thanks for reading


N(Posted 2009) [#2]
No.


Goodjee(Posted 2009) [#3]
well, this sucks
its so easy in java or c++


plash(Posted 2009) [#4]
If the types are that related that they must reference each other, you should certainly not have them in separate files.


Brucey(Posted 2009) [#5]
If the types are that related that they must reference each other, you should certainly not have them in separate files.

There are way around that of course... It's a design thing.


GW(Posted 2009) [#6]
cant you just include B.bmx in a then import a?


N(Posted 2009) [#7]
Could do something like this:

SectionName.bmx
SuperStrict

Include "SectionName+A.bmx"
Include "SectionName+B.bmx"

SectionName+A.bmx
Type A
  Field zB:B
End Type

SectionName+B.bmx
Type B
  Field zA:A
End Type

Then just import whatever SectionName.bmx is.


_Skully(Posted 2009) [#8]
Brucey,

Can you elaborate?

I'm having a similar problem with the Nate the Great's verlet Max integration into TileMax... I've had to modify verletMax to include references to TileMax MapTiles in place of his grid system which means I can no longer "compile" verletMax independently.


Goodjee(Posted 2009) [#9]
nilium, this is better than just including, but honestly i dont really like it :D


matibee(Posted 2009) [#10]
_Skully; you could cover this situation by writing a base "grid_interface" type that has virtual methods for all the required functionality. Then for testing, derive a working type using Nate's current code (or ask him to break his grid code down in this way ;) .)

VerletMax will need an instance of grid_interface and must use it throughout.

TileMax can then derive it's own grid_interface type and ask VM to use that instead.