[Suggestion] Forward declaration of functions
Posted: 04 Jan 2012, 21:12
The bigger a ManiaScript become, the more functions you add to it. And sooner or later you will stand before the problem: How to order the functions? Currently, where ever you call a function, this function must be defined somewhere before.
My suggestion is to introduce some kind of forward declarations of functions (afaik called prototyping in C/C++), so that the concrete order become less important. Let's have a small example showing what I mean:
This becomes important if you have two functions, which call each other to do some stuff -- Currently you have to go another way, as you cannot define each function before the other.
My suggestion is to introduce some kind of forward declarations of functions (afaik called prototyping in C/C++), so that the concrete order become less important. Let's have a small example showing what I mean:
Code: Select all
Integer DoSomething(Integer Param); // Forward declaration, "This function comes later"
Integer DoSomethingElse(Integer Param) {
return DoSomethind(Param) + 42;
}
// Finally define the function
Integer DoSomething(Integer Param) {
return 1337;
}