[fpc-devel] Suggestion for change: Overly strict check
Michael Van Canneyt
michael at freepascal.org
Thu Sep 28 11:40:54 CEST 2006
On Wed, 27 Sep 2006, Christian Iversen wrote:
> Hi all.
> I was hoping there could be a discussion of a certain feature in FPC, which
> doesn't work very well for us. Ultimately, I would like to see it gone
> completely. It's a very small extra-strong syntax check, appearantly
> implemented to avoid bad code. However, it's not entirely obvious why this is
> supposed to help.
> Please consider this example:
> tfoo = class(tbar)
> procedure Frob();
> procedure Wait(delay: integer);
> procedure ReadStuff(buffer: tbuffer; wait: boolean);
> When declaring classes or interfaces, it is specifically checked that the
> names of methods are NOT the same as _any_ variable name of _any_ other
> method in the class. This means that the example above will NOT compile.
> Now, in Delphi mode this check is not performed, and so the code above will
> compile without problems.
So, compile using Delphi mode. What's the problem ?
The check ensures that the namespace of the class is cleaner than in Delphi.
I have had several live examples where FPC has caught a bug in my Delphi code
So it stays in as far as I'm concerned, I think it is a very good check.
At the best, we could provide a command-line switch or directive to disable
or enable this check, but I would not recommend this at all.
More information about the fpc-devel