Hash

Hash (Hash로 변환)

어떤 객체를 키-값 쌍으로 이루어진 Hash로 바꿔야 할 때가 있어요. QuantHash 같은 타입도 그 변환이 필요하죠. Hash 메서드는 그 강제 변환을 담당해요.

출처: Raku Documentation — Hash

본문

role QuantHash에서

method Hash()

QuantHash 객체를 Hash로 강제 변환해요. 키는 객체를 문자열로 변환해서 만들고, 값에는 제한이 없어요. 변환된 Hash를 돌려줘요.

Any에서

multi method Hash( --> Hash:D)

호출자를 Hash로 강제 변환해요.