[chuck-users] same function name, differing signatures
Robert Poor
rdpoor at gmail.com
Wed Oct 28 00:03:25 EDT 2009
ChucK complains at the following:
// ==========
public class FooPie {
fun void bark() { <<< "woof" >>>; }
fun int bark(int value) { return value * 2; }
}
// ==========
saying "[foo_pie.ck]:line(3): function 'FooPie.bark' matches
'FooPie.bark' but cannot overload..."
This seems odd to me. bark(void) and bark(int) are two different
functions -- aren't they? -- so why should ChucK require them to have
the same return type? (Perhaps I'm just pining for Objective C, where
the internal function names would be FooPie.bark:void and
FooPie.bark:int which are clearly different functions.)
Unless Ge thinks this is a bug, I'm really only looking for an
explanation as to whether or not foo(void) and foo(int) are the same
function or not. Or at least how to think about functions with the
same name with different argument signatures.
- Rob
More information about the chuck-users
mailing list