On Sun, 07 Aug 2016 03:51:27 -0700, lloyd.fo...@gmail.com wrote:
> say Array[Int] ~~ Array[Int]; # True
> say Array[Int] ~~ Positional[Numeric];  # True
> say Positional[Int] ~~ Positional[Numeric]; # True
> say Array[Int] ~~ Array[Numeric]; # False
> 
> The last one should be true as well.

How come last one should be same? Aren't they different types? I'd expect 
`Array[Int] ~~ Positional[Numeric]` to give False

Some investigation: ( 
https://irclog.perlgeek.de/perl6-dev/2017-05-05#i_14534952 )

IIRC calling a method on a role puns it and in fact punned Positional doesn't 
accept a Positional of a different type, but calling .ACCEPTS does not appear 
to pun a role:

    00:58       Zoffix  Calling a method on a role puns it, right?
    00:58               m: say Positional[Numeric].ACCEPTS: Positional[Int]
    00:58       camelia rakudo-moar f2af3d: OUTPUT: «True␤»
    00:58       Zoffix  m: say Positional[Numeric].^pun.ACCEPTS: Positional[Int]
    00:58       camelia rakudo-moar f2af3d: OUTPUT: «False␤»
    01:00       Zoffix  m: say Positional[Numeric].self.ACCEPTS: Positional[Int]
    01:00       camelia rakudo-moar f2af3d: OUTPUT: «False␤»


Also, I don't know whether this is right or not; that `istype` op gives true 
when a role is parameterized with a type that accepts another...
    01:01       Zoffix  m: use nqp; dd nqp::istype(Positional[Int], 
Positional[Cool])
    01:01       camelia rakudo-moar f2af3d: OUTPUT: «1␤»
    01:01       Zoffix  Is it supposed to do that?

Reply via email to