I am trying to make a tactical role-playing game which I am
likely to open-source. Right now the code is very simple, with
only 3 files each containing a class with the same name.
The files are `Map.d`, `Tile.d`, and `Unit.d`. Each of these
files contains an `import` line to access one of the others. I
got the following errors when trying to compile all 3 files with
DMD, and the same errors after switching to DUB.
```
source/Unit.d(6,17): Error: import `Unit.Map` is used as a type
source/Unit.d(16,5): Error: import `Unit.Map` is used as a type
source/Tile.d(9,15): Error: import `Tile.Unit` is used as a type
source/Map.d(6,22): Error: import `Map.Tile` is used as a type
source/Map.d(19,11): Error: import `Map.Tile` is used as a type
```
I thought that the circular chain of imports may be the problem,
but removing all references to `Unit` in `Tile.d` did not fix the
problem.
Here are the contents of Tile.d:
```
import Unit;
class Tile
{
private bool allowStand = true;
private bool allowFly = true;
public int stickyness = 0;
public Unit* occupant;
bool allowUnit(bool isFlyer) {
if (isFlyer) return this.allowFly;
else return this.allowStand;
}
}
```
`Unit.d` & `Map.d` are longer files. `Map.d` begins with `import
Tile;`, and `Unit.d` begins with `import Map;`.
Why are the errors happening? What's the problem? Why is it
`currentclass.importedclass` instead of simply the imported class?