Michael Lazzaro asked:

All subroutines with multiple signatures would have this problem, right, even normal non-method subs?

foo $a, $b, $c, $d; # how many args?
Yep. Can't be known unless predeclared and hence compile-time discernible.

And methods can't be discerned in the presence of run-time dispatch.


Oof. I had been (foolishly?) hoping that if argument types were known at parse time (due to previous declarations), it would frequently be possible to resolve the multimethod variant during compilation.
That would be a very rare case. The whole point of late dispatch is
that it's the *run-time* types of the object(s) that determine which
method is called. Even if you write:

	my Foo $foo;

	# and later in the same lexical scope...

	$foo.bar();

there's no way at compile time of knowing what class of object $foo
contains. It could be a Foo object, or it could be an object of
any class that inherits from Foo. So there's no way of knowing
which class's C<bar> method to invoke.

Damian

Reply via email to