/
Whatever.pm
38 lines (33 loc) · 1.17 KB
/
Whatever.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
class Whatever is also {
method perl() {
return '*';
}
method ACCEPTS(Any $topic) {
return Bool::True;
}
}
# See src/classes/.pir for a description of the WhateverCodeX()
# function. Essentially it does the equivalent of creating a
# WhateverCode closure. Ideally we'd prefer
# multi sub infix:<+>(Whatever $a, $b) {
# WhateverCode(-> $_ { $_ + $b })
# }
# but Rakudo doesn't support block coercion yet, so we have
# a helper function to build it for us.
multi sub infix:<+>(Whatever $a, $b) is default
{ WhateverCodeX('infix:+', $a, $b) }
multi sub infix:<+>(WhateverCode $a, $b) is default
{ WhateverCodeX('infix:+', $a, $b) }
multi sub infix:<+>($a, Whatever $b)
{ WhateverCodeX('infix:+', $a, $b) }
multi sub infix:<+>($a, Whatever $b)
{ WhateverCodeX('infix:+', $a, $b) }
multi sub infix:<->(Whatever $a, $b) is default
{ WhateverCodeX('infix:-', $a, $b) }
multi sub infix:<->(WhateverCode $a, $b) is default
{ WhateverCodeX('infix:-', $a, $b) }
multi sub infix:<->($a, Whatever $b)
{ WhateverCodeX('infix:-', $a, $b) }
multi sub infix:<->($a, Whatever $b)
{ WhateverCodeX('infix:-', $a, $b) }
# vim: ft=perl6