# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #122992]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=122992 >


camelia was having some indigestion in the below backlog, which is why
I'm reporting some local evals (from "This is perl6 version
2014.09-202-g8b3e8c2 built on MoarVM version 2014.09-54-g03ac9a7").

<masak> m: class A { my ::?CLASS @.foo }; A.foo.push(2)
<camelia> rakudo-moar 86dc3c: OUTPUT«(timeout)»
<masak> locally, "Type check failed in .push; expected 'A' but got 'Int'"
<masak> (wow)
<masak> lizmat++ jnthn++, no doubt
<timotimo> masak: are they to blame for this? :)
<masak> timotimo: it's amazing! it recognizes `A` as the current
class, *and* it typechecks against it on .push
<masak> timotimo: woot!
<timotimo> that *is* neat.
<jnthn> masak: Note it's more useful use is in roles, where ::?CLASS is generic.
<masak> jnthn: I'm just about to factor my current code into a role :>
<masak> aww.
<masak> ===SORRY!===
<masak> No such method 'instantiate_generic' for invocant of type
'Array[::?CLASS]'
<jnthn> Awww :(
<masak> m: role R { my ::?CLASS @.x }; class C does R {}; say "alive"
<masak> locally: "No such method 'instantiate_generic' for invocant of
type 'Array[::?CLASS]'"
<camelia> rakudo-moar 86dc3c: OUTPUT«(timeout)»
<masak> jnthn: any non-torment reason that shouldn't be possible?
<masak> m: role R { my ::?CLASS $.x }; class C does R {}; say "alive"
<masak> locally: "alive"
<camelia> rakudo-moar 86dc3c: OUTPUT«(timeout)»
<masak> if I remove the ::?CLASS type constraint, using a role still works.
<masak> m: role R { has ::?CLASS @.x }; class C does R {}; say "alive"
<masak> locally: "alive"
<camelia> rakudo-moar 86dc3c: OUTPUT«(timeout)»
<masak> so it's only in the very specific case of `my` + `::?CLASS` +
`@` that it blows up...
<masak> oh, and `role`
<jnthn> masak: It's the "my" that does it
<jnthn> masak: I think it's fixable
<masak> nice.
* masak submits rakuodbug
<jnthn> Well, I'd not say it'll be nice to fix, but... :P
<jnthn> m: sub foo(::T $x) { my T @a; }; foo(42)
<camelia> rakudo-moar 86dc3c: OUTPUT«No such method
'instantiate_generic' for invocant of type 'Array[T]' [...]
<jnthn> Hah, gulf. :)
<masak> :)
<masak> but `my`, type parameter, and `@` sigil are still essential, yes?
<jnthn> Yes, but it can be a type parameter of a role or the sub
<masak> m: sub foo(::T $x) { my T %h; }; foo(42)
<camelia> rakudo-moar 86dc3c: OUTPUT«(timeout)»
<masak> locally, "No such method 'instantiate_generic' for invocant of
type 'Hash[T]'"

Reply via email to