Hi,
While converting some SUN Pascal Code to GNU Pascal, I encounter a problem of symbol name clash:
I have a module named 'Screen' that contains (and exports) a procedure named 'Screen'. When I compile the module, there is no problem, but when I want to Import SCREEN in an other module, the compiler produces an error on the Import line saying: bad import, and an other saying 'redeclaration of 'Screen'.
So it looks like one cannot have a module and a procedure with the same name. However the two are very different entities - from my point of view -. Are there other possible entities conflicts? (variable or type names) Is there a way to circumvent this problem?
Thanks
Pascal Viandier
pascal@accovia.com
Pascal Viandier wrote:
While converting some SUN Pascal Code to GNU Pascal, I encounter a problem of symbol name clash:
I have a module named 'Screen' that contains (and exports) a procedure named 'Screen'. When I compile the module, there is no problem, but when I want to Import SCREEN in an other module, the compiler produces an error on the Import line saying: bad import, and an other saying 'redeclaration of 'Screen'.
So it looks like one cannot have a module and a procedure with the same name.
More precisely, an interface name cannot match an identifier name. Modules and interfaces can be called different. But I doubt this will help you much, as the module name is basically meaningless. The interface name is what's used in qualified identifiers. (And that's just the reason why it mustn't conflict.)
However the two are very different entities - from my point of view -. Are there other possible entities conflicts? (variable or type names)
All identifiers can conflict with an interface name. E.g., if you have a module `Screen' containing a variable `Foo', and a variable `Screen' of record type with a field `Foo', then `Screen.Foo' would be ambiguous, that's why it's forbidden.
Is there a way to circumvent this problem?
Probably the easiest way is to rename the module (more precisely, the interface).
Frank