El 05/10/2016 a las 9:23, Graeme Geldenhuys escribió:
> On 2016-10-05 08:11, LacaK wrote:
>> Now I understand what happens, but isn't it bit confusing ?
> Yup, I would agree, and if possible, one should be removed.
Yes and no.
Yes, probably in this case one of them should be removed, but the reason
of why it's confusing is still there.
If you declare two functions with identical name in the same unit, you
get a "redeclared" error, unless you add the overload directive.
If you declare two functions with identical name in the different units,
the second "used" unit overrides, hides, the first declaration without
This behavior sometimes leads unexpected compiler errors that stops you
saying "what the...#@&?" for some time. Sometimes minutes, sometimes
until people get an answer from a forum . Handle types are a common
case. And compiler errors are the nice case, if there are not compiler
errors because the both declarations are compatibles, you get unexpected
behaviors that drives you nuts, like this case
I think that "automatic overriding" is a wrong design from the first
turbo pascal and should be fixed. The need of overriding system
functions like memory managers is a corner case to treat, not a reason
to not solve the unexpected hide of declarations.
fpc-pascal maillist - firstname.lastname@example.org