Parameter count mismatch should have precendence over type mismatch. (Indicating which parameter number has a type mismatch would also be nice)
Skybuck Flying <[email protected]> Sat, 27 Aug 2022 08:00:34 -0700 (PDT)
| Newsgroups | alt.comp.lang.borland-delphi |
|---|---|
| Message-ID | <[email protected]> |
The Delphi compiler and hint/warning/error messages could be improved by this new rule: "Parameter count mismatch should have precedence over type mismatch." I just encountered this situation in practice and for a newby it would be harder to understand what the problem is: The documentation for this method mentioned 3 parameters, while in reality it is 4: polygonToCells( @vGeoPolygon, ParaResolution, @vH3IndexArray ); polygonToCells( @vGeoPolygon, ParaResolution, vFlags, @vH3IndexArray ); The prototype/header/interface: function polygonToCells(const GeoPolygon: PGeoPolygon; res: Integer; flags: UInt32; &out: PH3Index): H3Error; cdecl; external UBER_H3 name _PU + 'polygonToCells'; Leading currently to the following errors: [dcc64 Error]<snip unit>(201): E2010 Incompatible types: 'Cardinal' and 'Pointer' First of all, it's impossible to tell, which parameter has the mismatch. So this is something in itself that could be improved. By stating: parameter 1 mismatch or parameter 2 mismatch or parameter 3 mismatch and so forth, depending on which one is the mismatch. But in this case the Delphi compiler could go even further, especially if the entire line is properly closed. It could detect a number of parameters mismatch. So, that the programmer does not start modifying the existing 3 parameters, believing that one of them is wrong, while in reality they are all correct. There is simply a missing parameter ! (If you compiler writers pull this one off, it will make the free pascal and/or delphi language more noob friendly, and let's face it, pascal is very well known for being a user friendly and "learning to program" language, further more I can remember that these kinds of errors used to confuse me in C/C++ as well, very maybe Delphi when I was a younger less experienced computer programmer, so this is definetly something you guys and gals(?) would like to check into to see if you can get this working.) Bye for now, Skybuck.