Duplicate identifier in two modules

BlitzMax Forums/BlitzMax Programming/Duplicate identifier in two modules

Fabian.(Posted 2006) [#1]
Currently it is possible to have two modules containing the same identifier, but it's not possible to create an application importing both modules. Normally this doesn't matter since it's not often that two (or more) modules contain functions/variables/types with the same name, however I now got problems with it - I got the same identifier TTCPStream in pub.bnetex and btbn.easytcp. Currently I don't understand why I can't compile any app importing these two modules, since I can exactly describe in the code which of these types I want to use by writing either pub.bnetex.TTCPStream or btbn.easytcp.TTCPStream.
It would be nice if this will be possible in the next compiler version.


Gabriel(Posted 2006) [#2]
Is it just user defined types? Because I don't have this problem with either variables or functions, but I may not have come across it with UDT's. I agree that - since BMax lets you specify a namespace - it would be nice to be able to do this. Although I'm not sure what would happen if you didn't specify a namespace, but I guess it's already trying to decide that with functions and variables, so I guess the same precedence could apply.


ziggy(Posted 2006) [#3]
Which is the compiler error you're getting?


Fabian.(Posted 2006) [#4]
Which is the compiler error you're getting?
"Compile Error: Duplicate identifier 'TTCPStream' in modules 'pub.bnetex' and 'btbn.easytcp'"

sorry; just tested; it seems to be different with modules and applications; in applications the compiler works exactly as I expected to, however when compiling modules it doesn't work.


Fabian.(Posted 2006) [#5]
I just tried to reproduce the error, it's a bit wired: you need three modules and one application using them.
So if you want to see this error you would need to create the following source files:

mod/test.mod/test0.mod/test0.bmx:
Strict
Module test.test0

Import test.test1

Type M
  Field F:T
EndType
mod/test.mod/test1.mod/test1.bmx:
Strict
Module test.test1

Type T
EndType
mod/test.mod/test2.mod/test2.bmx:
Strict
Module test.test2

Type T
EndType
untitled1.bmx:
Strict
Framework brl.blitz

Import test.test0
Import test.test2
Just rebuild the modules and try to build and run the application will produce that error message and the ide opens the following file and marks the third line in it:

mod/test.mod/test0.mod/test0.debug.win32.x86.i:
import brl.blitz
import test.test1
M^Object{
.F:T&
-New%()="_test_test0_M_New"
-Delete%()="_test_test0_M_Delete"
}="test_test0_M"
I've currently tested only on win32, but maybe it's the same on other platforms.