Well, say IntStr ~~ Str # True
In other words, IntStr *is* a Str. What I find interesting, however, is this difference: sub s (Str() :$str) {say $str.WHAT}; s(:str<1>) # IntStr sub s (Str :$str) {say $str.Str.WHAT}; s(:str<1>) # Str I would have expected the same output in both cases. On 2017-06-03 02:05:49, mt1...@gmail.com wrote: > Hi, > > In Rakudo version 2017.05-338-gaca1929 built on MoarVM version > 2017.05-25-g62bc54e > implementing Perl 6.c I saw that a type could be changed through an > assignment which It should not do. In REPL; > > > > my Str $s = IntStr.new(12,'12'); > 12 > > $s.WHAT > (IntStr) > > > > The type IntStr should be coerced into Str. A second example happened in > my code and golfed in REPL > > > > > sub s (Str :$str) {say $str.WHAT} > sub s (Str :$str) { #`(Sub|89412592) ... } > > s(:str<1>) > (IntStr) > > s(:str<a>) > (Str) > > > The type should stay as it was defined I think. > Marcel