Skip to content
Permalink
Browse files

Introduce R:I:ImplementationDetail role

Classes marked with this role can not be instantiated with .new, and will
stringify to a message indicating that they're a Rakudo specific implementation
detail.

Inspired by R#2575
  • Loading branch information...
lizmat committed Dec 31, 2018
1 parent 26c0e62 commit d248d47e79589072e3ac1ac3e3098d4d29aac135
Showing with 10 additions and 0 deletions.
  1. +10 −0 src/core/Rakudo/Internals.pm6
@@ -452,6 +452,16 @@ my class Rakudo::Internals {
)
}

our role ImplementationDetail {
method new(|) { die self.gist }
method gist(--> Str:D) {
"The '{self.^name}' class is a Rakudo-specific
implementation detail and has no serviceable parts inside"
}
method Str( --> Str:D) { self.gist }
method perl(--> Str:D) { self.gist }
}

our role ShapedArrayCommon {
method !illegal($operation) {
X::IllegalOnFixedDimensionArray.new(:$operation).throw

0 comments on commit d248d47

Please sign in to comment.
You can’t perform that action at this time.