/
Bool.pir
57 lines (38 loc) · 926 Bytes
/
Bool.pir
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
## $Id$
=head1 TITLE
Bool - Perl 6 boolean class
=head1 DESCRIPTION
This file sets up the Perl 6 C<Bool> class, and initializes
symbols for C<Bool::True> and C<Bool::False>.
=head1 Methods
=over 4
=cut
.namespace ['Bool']
.sub 'onload' :anon :init :load
.local pmc p6meta, boolproto, abstraction
p6meta = get_hll_global ['Mu'], '$!P6META'
boolproto = p6meta.'new_class'('Bool', 'parent'=>'parrot;Boolean Cool')
$P0 = boolproto.'new'()
$P0 = 0
set_hll_global ['Bool'], 'False', $P0
set_hll_global 'False', $P0
$P0 = boolproto.'new'()
$P0 = 1
set_hll_global ['Bool'], 'True', $P0
set_hll_global 'True', $P0
.end
.sub 'succ' :method
$P0 = get_global 'True'
.return ($P0)
.end
.sub 'pred' :method
$P0 = get_global 'False'
.return ($P0)
.end
=back
=cut
# Local Variables:
# mode: pir
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir: