[B3.1][MS] Overloading of functions with identical signature

Moderator: NADEO

Locked
User avatar
m4rcel
Posts: 650
Joined: 15 Jun 2010, 11:12
Contact:

[B3.1][MS] Overloading of functions with identical signature

Post by m4rcel »

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:

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 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.)
ImageImage
Image
Locked

Return to “Maniaplanet Reports”

Who is online

Users browsing this forum: No registered users and 1 guest