On 28/04/2021 6:26 pm, Martin Frb via fpc-pascal wrote: > Would omitting the type info not lead to issues with overloaded functions?
Luckily others have already solved that problem. :-) Here is Java's JSR-355 and overloading is covered in Section F. https://jcp.org/aboutJava/communityprocess/final/jsr335/index.html The Java compiler does a three step processed to find the best match. Alternatively, the developer could also list the argument types to help out. So to extend your example, the optional type could be added by the developer. foo(function(a,b: integer)) foo(function(a,b: string)) foo(function(a: integer, b: string)) But even the Java developers found cases that were really hard or impossible to determine by the compiler alone, and opted to forgo overloading and change the interface. For example: fooInteger(function(a,b)) fooString(function(a,b)) Not ideal, but more as a last resort. Regards, Graeme _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal