You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looks like only methods don't care if signatures match:
$ perl6 -e 'role Foo { method bar (Int) { … } }; class Bar does Foo { method bar(Str) { } }'
$
Yet, the functionality of enforcing correct signatures is available if you swap to using multi methods:
$ perl6 -e 'role Foo { multi method bar (Int) { … } }; class Bar does Foo { multi method bar(Str) { } }'
===SORRY!=== Error while compiling -e
Multi method 'bar' with signature :(Bar: Int $, *%_) must be implemented by Bar because it is required by a role
at -e:1
$ perl6 -v
This is Rakudo version 2018.06-146-g1b3dd35 built on MoarVM version 2018.06-141-gcae4731
implementing Perl 6.c.
IMO, only methods should enforce signatures too.
The text was updated successfully, but these errors were encountered:
From https://stackoverflow.com/questions/52861619/are-typed-signatures-for-stubbed-methods-not-enforced-in-roles-for-perl6
Looks like
onlymethods don't care if signatures match:Yet, the functionality of enforcing correct signatures is available if you swap to using
multimethods:IMO,
onlymethods should enforce signatures too.The text was updated successfully, but these errors were encountered: