Open p6rt opened 12 years ago
\
On Wed, 21 Mar 2012 08:32:55 -0700, masak wrote:
\
nom: role A[::T $] { also is T }; class B { }; class C does A[B] { }; say C ~~ B \ rakudo 1a468d: OUTPUT«===SORRY!===Cannot type check against type variable T»
Now it throws earlier, and with a nicer error message:
===SORRY!=== Error while compiling -e T does not support inheritance, so A cannot inherit from it
Not sure if it can be made to work like you wanted.
Not sure if it can be made to actually work (i.e. defer the `also is T` until class composition time, at which point the concrete type of T would be available).
Seems related to: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=130634
The RT System itself - Status changed from 'new' to 'open'
It looks like this works now as expected:
$ ./rakudo-m -e 'role A[::T $] { also is T }; class B {}; class C does A[B] {}; say C ~~ B'
True
Tagging "testneeded".
I'm actually a little bit shocked that this works. My mental model needs to do some stretching exercises before attempting to cover a semantics where this Just Works. I'm now very curious, and might dip into the implementation just to see what's going on. (Note message from smls in 2017, "Not sure if it can be made to work like you wanted.")
Is it the case that the role body contains a... "script" (with possibly-late-bound things like T
) which executes on role composition (after substituting B
into T
)? That's the only way I can imagine this working at all.
For the record -- and maybe helpful if you want to look at the implementation: According to bisectable6
(https://colabti.org/irclogger/irclogger_log/raku-dev?date=2023-10-08#l10) the behavior changed (from dying with T does not support inheritance, so A cannot inherit from it
to printing True
) with commit https://github.com/rakudo/rakudo/commit/4b99656875.
That is indeed helpful. Thank you! I can't say I follow the diff perfectly, but the commit message indeed settles whether this was a deliberate move or not.
Migrated from rt.perl.org#111912 (status was 'open')
Searchable as RT111912$