This was a surprise. Are the argument types of declarations purely decoration? As far as I can tell, they are never tested by the parser.
Note that this example has no runtime errors and every argument is effectively an "int" regardless of the type actually specified by the function definition:
I would seem that argument types are merely a form of type "hinting" that is required, never validated, and therefore may end up providing the wrong information when used as a reference.
Note that this example has no runtime errors and every argument is effectively an "int" regardless of the type actually specified by the function definition:
Code:
void testFuncTypes(bool a, int b, float c, string d, object e, ref f, aref g) {
a = 123;
b = 123;
c = 123;
d = 123;
e = 123;
f = 123;
g = 123;
trace("bool : " + a);
trace("int : " + b);
trace("float : " + c);
trace("string : " + d);
trace("object : " + e);
trace("ref : " + f);
trace("aref : " + g);
}
void ExecuteConsole()
{
int num = 0;
testFuncTypes(num, num, num, num, num, num, num);
}
I would seem that argument types are merely a form of type "hinting" that is required, never validated, and therefore may end up providing the wrong information when used as a reference.
Last edited: