class Foo {} fun bar(a, b) { print "bar"; print a; print b; } var foo = Foo(); foo.bar = bar; foo.bar(1, 2); // out: bar // out: 1 // out: 2