view src/core.c/Whatever.pm6 @ 0:c341f82e7ad7 default tip

Rakudo branch in cr.ie.u-ryukyu.ac.jp
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 26 Dec 2019 16:50:27 +0900
parents
children
line wrap: on
line source

my class X::Cannot::Capture { ... }
my class X::Cannot::New     { ... }

my class Whatever {
    multi method ACCEPTS(Whatever:D: Mu --> True) { }
    multi method perl(Whatever:D: --> '*') { }
    multi method Str(Whatever:D: --> '*') { }
    method Capture() { X::Cannot::Capture.new( :what(self) ).throw }
}

my class HyperWhatever {
    multi method new(HyperWhatever:) { X::Cannot::New.new(class => self).throw }
    multi method ACCEPTS(HyperWhatever:D: $ --> True) { }
    multi method perl(HyperWhatever:D:) { '**' }
    method Capture() { X::Cannot::Capture.new( :what(self) ).throw }
}

sub HYPERWHATEVER (&c) { sub (*@_) { map &c, @_ } }

# vim: ft=perl6 expandtab sw=4