Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arrays and hashes don't parameterize inside role methods #5484

Open
p6rt opened this issue Jul 25, 2016 · 1 comment
Open

Arrays and hashes don't parameterize inside role methods #5484

p6rt opened this issue Jul 25, 2016 · 1 comment
Labels

Comments

@p6rt
Copy link

p6rt commented Jul 25, 2016

Migrated from rt.perl.org#128726 (status was 'new')

Searchable as RT128726$

@p6rt
Copy link
Author

p6rt commented Jul 25, 2016

From @ShimmerFairy

$ 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.

@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant