Larry Wall wrote:
On Fri, Oct 13, 2006 at 04:56:05PM -0700, Jonathan Lang wrote:
: Trey Harris wrote:
: >All three objects happen to be Baz's, yes. But the client code doesn't
: >see them that way; the first snippet wants a Foo, the second wants a Bar.
: >They should get what they expect, or Baz can't be said to "do" either.
: In principle, I agree; that's how it _should_ work. I'm pointing out
: that that's not how things work in practice according to the current
The current documentation already conjectures this sort of disambiguation
at S12:996, I believe.
Help me to get that right with a little, more concrete example.
my Num $a = 5; # dynamic type is Int
my Num $b = 4;
say $a/$b; # 1 or 1.25?
When we assume that Int is a subtype of Num and leave co- and
contravariance issues of container types out of the picture
and further assume the availability of dispatch targets :(Int,Int-->Int)
and :(Num,Num-->Num) in multi infix:</> then there is a conflict
between the static type information of the container and the dynamic
type of the values. And it resolves to the static container type
unless it is typed as Any, then the dynamic type is used. Right?
I know that the return type of / could be Num in "reality" but that
spoils the example. Sorry if the above is a bad example.