raku-type-x-role-initialization

class X::Role::Initialization is Exception { }

SomeRole($init) 같은 문법을 썼는데, SomeRole공개 속성이 정확히 하나 있지 않을 때 던져지는 예외예요.

예를 들어 볼게요.

role R { }; "D2" but R(2)
CATCH { default { put .^name, ': ', .Str } }
# OUTPUT: «X::Role::Initialization: Can only supply an initialization value for a role if it has a single public attribute, but this is not the case for 'R'␤»

역할이 공개 속성을 하나만 가질 때만 그 값으로 초기화할 수 있는데, R은 그렇지 않으니 이 예외가 나오는 거예요.

Methods

method role

method role()

오류의 원인이 된 역할을 돌려줘요.