Larry Wall wrote:
I think it's perfectly fine for the compiler to make use of whatever
information it has.  The trick is to never make any unwarranted
assumptions, such as "Nobody will ever add another class with an 'm'
method."

Er, isn't that not just the wrong way around? The point is to do the bookkeeping that an object is needed that does .meth() and that it is stored in $a, and to complain when that is not the case when it should be. The earlier the better.

I don't understand why writing 'my X $a' needs at least a declaration
of X, but then '$a.meth()' does not consider '.meth' as a bare method
that needs a declaration in X? Polymorphism is about requiring that
objects do compare and then sort a bunch of them using that particular
role---not more not less. Or think of US Postal just transporting letters
irrespective of them containing Anthrax or not, as long as they bear the
right stamps!
--
TSa (Thomas Sandla▀)




Reply via email to