Skip Menu |
Report information
Id: 128726
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: lue <rnddim [at] gmail.com>
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: Arrays and hashes don't parameterize inside role methods
Download (untitled) / with headers
text/plain 906b
$ perl6 -e 'role A[::T = Numeric] { method B() { my T $a; say $a.WHAT } }; A.new.B' (Numeric) $ perl6 -e 'role A[::T = Numeric] { method B() { my T @a; say @a.WHAT } }; A.new.B' Method 'instantiate_generic' not found for invocant of class 'Array[T]' in method B at -e line 1 in block <unit> at -e line 1 $ perl6 -e 'role A[::T = Numeric] { method B() { my T %a; say %a.WHAT } }; A.new.B' Method 'instantiate_generic' not found for invocant of class 'Hash[T]' in method B at -e line 1 in block <unit> at -e line 1 The variable declarations here show a problem in likely the MOP. You can see this problem in a different light beyond type constraining variables: $ perl6 -e 'role A[::T = Numeric] { method B() { say T; say Array[T]; say Hash[T]; } }; A.new.B' (Numeric) (Array[T]) (Hash[T]) Namely, the fact that the parameter to arrays and hashes doesn't get "resolved" like it does as a scalar.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org