Well, Unfortunately, this is bad for us here. SVS and some of the old Oasis Pascal and other Pascal compiler developed back in the mid and early 1980s allowed this split interface/implementation method declaration in different Units.
This allows one Unit to act as a sort of header file (like in C) and the other Unit to actually define the function. In this way, you can have a global type repository of Units that only contain Interface declarations. When dealing with an App like ours where you are dealing with 500000 to 900000 lines of code in 200-400 files in 10+ project trees, changing something as simple as this could end up being a hufe proposition. That would be on top of the changes to FILLCHARing records, Strings that aren't of the "BP String" type, and other differences we find.
As for Mangled Names? Are you going to move more towards name Mangling much like FPC uses? If so, couldn't create a flag that would just keep all functions from using the Mangled Name? FPC does things much in this way, and I worked on modifying the compiler to allow this method in split interface/implementation type of thing. I ran into other problems getting it to work correctly (I'll spare the list the details) but for the most part, it worked.
Adam
-----Original Message----- From: Frank Heckenbach [mailto:frank@g-n-u.de] Sent: Thursday, October 18, 2001 7:09 PM To: gpc@gnu.de Subject: Re: Is this a bug that is planning to be fixed (from documentatio n)?
Oldham, Adam wrote:
So, once this bug is fixed, will function declarations in the interface
and
function bodies in implementation sections of different files be allowed, like they are today?
Different files for the same module, yes (unfortunately, since EP more or less requires this, though it doesn't directly talk about source files). Different units/modules, no.
And if not, can the bug sort of be left for compatibility with other Pascal Languages that do utilize this method?
Say
with maybe a command line parameter?
Which compiler uses this method? I only know compilers that require such routines to be declared as `external' or similar, and GPC will (continue to) allow this as well.
Disabling this check would be easy at first, but once we introduce qualified identifiers, the method won't work, since the implementation would choose another "mangled linker name" (if you don't know what that means, please ignore it) than the interface declaration, and without an explicit specification (such as `external' and/or `asmname'), it won't work.
Frank
Oldham, Adam wrote:
Well, Unfortunately, this is bad for us here. SVS and some of the old Oasis Pascal and other Pascal compiler developed back in the mid and early 1980s allowed this split interface/implementation method declaration in different Units.
Units? Are they like BP units otherwise, or do they look completely differently? (I don't know these compilers.)
This allows one Unit to act as a sort of header file (like in C) and the other Unit to actually define the function. In this way, you can have a global type repository of Units that only contain Interface declarations. When dealing with an App like ours where you are dealing with 500000 to 900000 lines of code in 200-400 files in 10+ project trees, changing something as simple as this could end up being a hufe proposition. That would be on top of the changes to FILLCHARing records, Strings that aren't of the "BP String" type, and other differences we find.
There are several. Possibilities:
- Merge each interface and the corresponding implementation to a BP unit
- Don't actually merge files, but use {$include}s
- Use EP modules where interface and implementation can remain in separate files (only add module foo interface/implementation; ... end. around them).
All of this looks like is can easily be automatized. A little script should do.
Or actually declare each thing in the interfaces `external'. Then GPC won't (in the future) expect an implementation in that unit.
As for Mangled Names? Are you going to move more towards name Mangling much like FPC uses?
I don't know exactly what FPC uses at the moment, but something simiilar, anyway.
If so, couldn't create a flag that would just keep all functions from using the Mangled Name?
I think we could do that then.
Frank