Skip to content
Newer
Older
100644 119 lines (77 sloc) 2.58 KB
726d70f Lots more stuff in S32. Documented Callable objects, and extended Con…
wayland authored
1 =encoding utf8
2
3 =head1 Title
4
5 DRAFT: Synopsis 32: Setting Library - Executeable
6
7 =head1 Version
8
9 Author: Tim Nelson <wayland@wayland.id.au>
10 Maintainer: Larry Wall <larry@wall.org>
11 Contributions: Tim Nelson <wayland@wayland.id.au>
12 Date: 26 Feb 2009
1da2dd8 [Callable] defined defined on Code
lwall authored
13 Last Modified: 3 May 2009
14 Version: 2
726d70f Lots more stuff in S32. Documented Callable objects, and extended Con…
wayland authored
15
16 The document is a draft.
17
18 If you read the HTML version, it is generated from the pod in the pugs
19 repository under /docs/Perl6/Spec/S32-setting-library/Exception.pod so edit it there in
20 the SVN repository if you would like to make changes.
21
22 This document documents Code, Block, Signature, Capture, Routine, Sub, Method, Submethod,
23 and Macro.
24
25 =head1 Roles
26
27 =head2 Callable
28
29 role Callable {...}
30
31 The C<Callable> role implies the ability
32 to support C<< postcircumfix:<( )> >>.
33
34 =head2 Code
35
36 # Base class for all executable objects
0d55ac5 - Standardised on .signature vs. .sig
wayland authored
37 role Code {
38 method Signature signature() {...}
bd2bd5e More masak-inspired changes.
wayland authored
39 method Code assuming(...) {...}
40 method do() {...} # See L<S12/Introspection>
1da2dd8 [Callable] defined defined on Code
lwall authored
41 method Bool defined {...}
d802fb9 Assuming .^methods returns an array of Method objects, I'mve document…
wayland authored
42 # XXX What does do() return? I mean, it's a "method body", but what's that?
0d55ac5 - Standardised on .signature vs. .sig
wayland authored
43 }
726d70f Lots more stuff in S32. Documented Callable objects, and extended Con…
wayland authored
44
1da2dd8 [Callable] defined defined on Code
lwall authored
45 For C<Code>, the C<.defined> method returns whether a body has
46 been defined. A body consisting only of C<...>, C<!!!>, or C<???>
47 (with optional message arguments) does not count as defined.
48
49 To test if a name has been declared, look up the symbol in the
50 appropriate symbol table.
51
726d70f Lots more stuff in S32. Documented Callable objects, and extended Con…
wayland authored
52 =head2 Block
53
54 # Executable objects that have lexical scopes
0d55ac5 - Standardised on .signature vs. .sig
wayland authored
55 role Block does Code does Callable {
56 method next() {...}
57 method last() {...}
58 method redo() {...}
59 method leave() {...}
60 method labels() {...}
d802fb9 Assuming .^methods returns an array of Method objects, I'mve document…
wayland authored
61 method as() {...} # See L<S12/Introspection> and L<S02/Value types>
0d55ac5 - Standardised on .signature vs. .sig
wayland authored
62 }
726d70f Lots more stuff in S32. Documented Callable objects, and extended Con…
wayland authored
63
64 =head2 Signature
65
66 # Function parameters (left-hand side of a binding)
67 role Signature {...}
68
69 =head2 Capture
70
71 # Function call arguments (right-hand side of a binding)
72 role Capture does Positional does Associative {...}
73
bd2bd5e More masak-inspired changes.
wayland authored
74 =head2 WrapHandle
75
76 role WrapHandle {...}
77
726d70f Lots more stuff in S32. Documented Callable objects, and extended Con…
wayland authored
78 =head1 Classes
79
80 =head2 Routine
81
d802fb9 Assuming .^methods returns an array of Method objects, I'mve document…
wayland authored
82 class Routine does Block {
83 method WrapHandle wrap(Code $code) {...}
84 method Routine unwrap(Wraphandle $original) {...}
85 method Str name() {...}
86 method Bool multi() {...}
87 }
bd2bd5e More masak-inspired changes.
wayland authored
88
89 =item unwrap
90
91 See L<S06/Wrapping>.
92
93 =item wrap
94
95 method wrap(Code $code) {...}
96
97 See L<S06/Wrapping>.
726d70f Lots more stuff in S32. Documented Callable objects, and extended Con…
wayland authored
98
99 =head2 Sub
100
101 class Sub isa Routine {...}
102
103 =head2 Method
104
105 class Method isa Routine {...}
106
107 =head2 Submethod
108
109 class Submethod isa Routine {...} # XXX or should this be isa Sub
110
111 =head2 Macro
112
113 class Macro isa Routine {...}
114
115 =head1 Additions
116
117 Please post errors and feedback to perl6-language. If you are making
118 a general laundry list, please separate messages by topic.
Something went wrong with that request. Please try again.