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 ;-)

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 ;-)


-- 
Un saludo
Santiago A.
s...@ciberpiula.net


--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to