[B3.1][MS] Overloading of functions with identical signature
Posted: 15 Mar 2013, 18:49
This is not a major bug, but I want to report it as the compiler should complain about it.
It is possible to overload a function with a identical signature, i.e. with the same number and types of parameters. See the following script:
The first two declarations of "Function" are okay, as the parameter type differs. Yet you are able to redeclare the same function with an already existing signature, making this function to a dead function which you cannot call.
The compiler should complain about this issue, because you may wonder why your function is not called, because it already exists somewhere else. (I had that problem: I introduced a new function, yet accidentially gave it a name and parameter list of an already existing one, and wondered, why my new function was never executed.)
It is possible to overload a function with a identical signature, i.e. with the same number and types of parameters. See the following script:
Code: Select all
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<manialink version="1" background="title">
<timeout>0</timeout>
<script><!--
Void Function(Integer Param) {
log(Param);
}
Void Function(Text Param) {
log(Param);
}
Void Function(Integer Param) {
log("This method cannot be called. " ^ Param);
}
main() {
Function(42);
Function("Hello World");
}
--></script>
</manialink>
The compiler should complain about this issue, because you may wonder why your function is not called, because it already exists somewhere else. (I had that problem: I introduced a new function, yet accidentially gave it a name and parameter list of an already existing one, and wondered, why my new function was never executed.)