Oxygen Basic
Programming => Bugs & Feature Requests => Topic started by: Brian Alvarez on January 12, 2019, 10:22:38 PM
-
If it doesnt find an exact match, it just takes the last one, instead of the one that matches the most:
FUNCTION sources() as wstring
wstring ss = "source"
return ss
END FUNCTION
function handler(wstring ss, wstring d = "unicode!") as long ' this one should be used....
print "UNICODE HANDLER: " + ss
end function
function handler(string ss, string d = "ANSI!") as long ' instead uses this one.
print "ANSI HANDLER: " + ss
end function
handler sources()
-
Here is another example, i think the isssue is more evident, because it has 2 ANSI strings, yet, the unicode handler is picked:
FUNCTION sources() as string
string ss = "source"
return ss
END FUNCTION
function handler(string ss, string d = "ANSI!") as long
print "ANSI HANDLER: " + ss
end function
function handler(wstring ss, wstring d = "unicode!") as long
print "UNICODE HANDLER: " + ss
end function
handler sources(), "ansi string!"
-
There is a conflict between function-overloading and default parameters. When evaluating a match, function-overloading only works with definite parameters.