[Lazarus] Forward declaration not solved

Marcos Douglas md at delfire.net
Fri Aug 9 22:00:06 CEST 2013


On Fri, Aug 9, 2013 at 3:13 PM, Santiago Amposta <svaa at ciberpiula.net> wrote:
> El 09/08/2013 11:15, Antonio Fortuny escribió:
>>
>> But the isn't there some ambiguity between LCL declarations and FPC
>> declarations for what is obviously the same type ?
>> Thanks Mattias,
>>
>
> In delphi, exists sysutils.abort and windows.abort. I don't know how
> long it took me to find the bug: Just because "windows" was used after
> "sysutils". In this case the compiler didn't complain, and the errors
> where very weird.
>
> Other languages, like Ada, raise a compiler error.  IMHO, the FPC should
> not allow such ambiguity and raise an error, asking to qualify the
> identifier. I suppose it would break backward compatibility, a directive
> {$Check_Ambiguity+} would be fine for me ;-)

+1

> When you work with big programs, you are going to face with identifier
> collisions.  The solution is not to change identifier, probably each
> unit programmer chose such name for good reasons,  but using namespaces,
> that object pascal already has. The current solution, relying in the
> order of units to guess which one will pick, is a prone of errors, and
> sometimes very difficult to find, because most of us aren't aware of
> this most time, and don't code with this concept in mind. With hundreds
> of third party libraries and components, I am sure many people have hit
> this error and gone nuts for a while.
>
> The reason why things like this don't happen more often is because units
> usually contain objects and we use things encapsulated in object more
> often than global identifiers. But that is not an excuse, relying in
> "uses" order is a poor decision from old times that could be improved.
>
> Sure it's a FPC topic, but I couldn't help... it's just a rant ;-)

Namespaces was discussed many times on FPC list and many ideas were
said, however no idea was good enough for FPC team, unfortunately.

Regards,
Marcos Douglas




More information about the Lazarus mailing list