[fpc-devel] Parameters must match exactly?
klenin at gmail.com
Thu May 20 07:57:13 CEST 2010
I would like to return the discussion to the original question,
now with the real code sample ;-)
Look at r21318 of Lazarus (tachart: fixed compilation with fpc 2.5.1,
[BTW, is there any web-interface for browsing Lazarus SVN?]
I think it is a typical sample of change required to production code
by the restriction we are discussing.
Looking at the diff, I'd argue that:
1) Old version was cleaner.
2) New version is _not_ any safer, since any type error in the old code
will result in exactly the same consequences with the new one.
So, the additional inconvenience to developer did not pay off.
To really address the problem, I think compiler should insert a run-time type
check (e.g. the as operator) automatically.
This way, original code will continue to work unchanged _and_
the programmer will get a clear exception in the case of error.
Alexander S. Klenin
More information about the fpc-devel