Skip to content
This repository
Newer
Older
100644 402 lines (255 sloc) 11.989 kb
fba2bc19 » coke
2010-04-14 PDD cleanup (TT #1536); Remove maintainer, changes sections.
1 # Copyright (C) 2001-2010, Parrot Foundation.
a40f31b6 » Dan Sugalski
2002-04-27 Added docs on Parrot's calling conventions.
2
740e7748 » allisonrandal
2009-03-09 [cage] Cleaning up the PDD titles for better display and
3 =head1 PDD 3: Calling Conventions
a40f31b6 » Dan Sugalski
2002-04-27 Added docs on Parrot's calling conventions.
4
49bf7e65 » allisonrandal
2009-02-08 [doc] Abandoning daft Perl 5-style documentation headings.
5 =head2 Abstract
a40f31b6 » Dan Sugalski
2002-04-27 Added docs on Parrot's calling conventions.
6
0abc6ea3 » chipdude
2005-11-30 Bring pdd03 out of clip purgatory.
7 Parrot's inter-routine calling conventions.
a40f31b6 » Dan Sugalski
2002-04-27 Added docs on Parrot's calling conventions.
8
6d3f9cfb » chipdude
2005-06-13 It's all new. All of it.
9
8682534f » leto
2011-02-21 [cage] Remove more svn-- remnants from our PDDs
10
11
6d3f9cfb » chipdude
2005-06-13 It's all new. All of it.
12
49bf7e65 » allisonrandal
2009-02-08 [doc] Abandoning daft Perl 5-style documentation headings.
13 =head2 Synopsis
7d2f0b57 » jkeenan
2008-04-03 Make PPD conform to coding standard for PDDs (https://rt.perl.org/rt3…
14
15 Not applicable.
16
49bf7e65 » allisonrandal
2009-02-08 [doc] Abandoning daft Perl 5-style documentation headings.
17 =head2 Description
a40f31b6 » Dan Sugalski
2002-04-27 Added docs on Parrot's calling conventions.
18
8e58c2e3 » jhoblitt
2005-10-05 reformat all Pods under docs/pdds
19 This document describes how to pass arguments from registers to subroutines,
20 and how subroutines can extract their parameters into registers for use.
b27d0f78 » Dan Sugalski
2003-05-02 Fixed calling convention docs. Again
21
8e58c2e3 » jhoblitt
2005-10-05 reformat all Pods under docs/pdds
22 Since Parrot's calling conventions are continuation-based, there is arguably
23 very little difference between a call and a return. Because of this, the
24 conversion rules are the same regardless of whether code is invoking a
25 subroutine or a return continuation.
6d3f9cfb » chipdude
2005-06-13 It's all new. All of it.
26
49bf7e65 » allisonrandal
2009-02-08 [doc] Abandoning daft Perl 5-style documentation headings.
27 =head3 Common Features of Argument/Return Opcodes
6d3f9cfb » chipdude
2005-06-13 It's all new. All of it.
28
8e58c2e3 » jhoblitt
2005-10-05 reformat all Pods under docs/pdds
29 There are four opcodes involved in parameter and return value propagation:
a40f31b6 » Dan Sugalski
2002-04-27 Added docs on Parrot's calling conventions.
30
31 =over 4
32
6d3f9cfb » chipdude
2005-06-13 It's all new. All of it.
33 =item *
a40f31b6 » Dan Sugalski
2002-04-27 Added docs on Parrot's calling conventions.
34
6d3f9cfb » chipdude
2005-06-13 It's all new. All of it.
35 C<set_args>, for passing arguments;
a40f31b6 » Dan Sugalski
2002-04-27 Added docs on Parrot's calling conventions.
36
6d3f9cfb » chipdude
2005-06-13 It's all new. All of it.
37 =item *
a40f31b6 » Dan Sugalski
2002-04-27 Added docs on Parrot's calling conventions.
38
6d3f9cfb » chipdude
2005-06-13 It's all new. All of it.
39 C<set_returns>, for returning values;
a40f31b6 » Dan Sugalski
2002-04-27 Added docs on Parrot's calling conventions.
40
6d3f9cfb » chipdude
2005-06-13 It's all new. All of it.
41 =item *
a40f31b6 » Dan Sugalski
2002-04-27 Added docs on Parrot's calling conventions.
42
6d3f9cfb » chipdude
2005-06-13 It's all new. All of it.
43 C<get_params>, for accepting parameters; and
a40f31b6 » Dan Sugalski
2002-04-27 Added docs on Parrot's calling conventions.
44
6d3f9cfb » chipdude
2005-06-13 It's all new. All of it.
45 =item *
b27d0f78 » Dan Sugalski
2003-05-02 Fixed calling convention docs. Again
46
6d3f9cfb » chipdude
2005-06-13 It's all new. All of it.
47 C<get_results>, for accepting return values.
b27d0f78 » Dan Sugalski
2003-05-02 Fixed calling convention docs. Again
48
6d3f9cfb » chipdude
2005-06-13 It's all new. All of it.
49 =back
8f37cf58 » Dan Sugalski
2003-02-06 tweak calling conventions
50
0abc6ea3 » chipdude
2005-11-30 Bring pdd03 out of clip purgatory.
51 FAQ: Given Parrot's internal use of continuation-passing style ["CPS"], it
52 would be possible to use one pair of opcodes for both call and return, since
53 under CPS returns I<are> calls. And perhaps someday we will have only two
2be4a288 » Bob Rogers
2008-04-07 * docs/pdds/draft/pdd06_pasm.pod:
54 opcodes. But for now, certain efficiency hacks are easier with four opcodes.
0abc6ea3 » chipdude
2005-11-30 Bring pdd03 out of clip purgatory.
55
6d3f9cfb » chipdude
2005-06-13 It's all new. All of it.
56 The common syntax of these opcodes is:
8f37cf58 » Dan Sugalski
2003-02-06 tweak calling conventions
57
3b2acafa » paultcochrane
2007-09-18 [pdd] Removed deprecated opcode syntax as recommended by Allison Rand…
58 <set_opcode> "flags0, flags1, ..., flagsN", VAL0, VAL1, ... VALN
59 <get_opcode> "flags0, flags1, ..., flagsN", REG0, REG1, ... REGN
60 <get_opcode> "..., 0x200, flags0, ...", ..., "name", REG0, ...
8155c8a8 » Leopold Toetsch
2005-04-04 MMD 16 - builtin infix multis
61
8e58c2e3 » jhoblitt
2005-10-05 reformat all Pods under docs/pdds
62 The flags string is a literal quoted string denoting a list of zero or more
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
63 comma-separated integers. Integers may be specified either in decimal, or if
64 prefixed with "0b"/"0x", in binary/hexadecimal. There must be exactly one
65 integer for each value or register given.
66
0abc6ea3 » chipdude
2005-11-30 Bring pdd03 out of clip purgatory.
67 For documentation purposes we'll number the bits 0 (low) through 30 (high).
68 Bit 31 (and higher, where available) will not be used.
69
c410b60d » chipdude
2006-02-27 * Add two more TYPE, allowing for the unknown future.
70 Some values and registers do not correspond directly to values passed or
71 received. (See the descriptions of the OPT_FLAG and NAMED bits, below.)
72
49bf7e65 » allisonrandal
2009-02-08 [doc] Abandoning daft Perl 5-style documentation headings.
73 =head4 Flag Words; Common Flag Word Bits
a40f31b6 » Dan Sugalski
2002-04-27 Added docs on Parrot's calling conventions.
74
8e58c2e3 » jhoblitt
2005-10-05 reformat all Pods under docs/pdds
75 Each integer in the flag string controls the processing of the corresponding
76 value or register.
7dccda2b » Dan Sugalski
2003-11-17 Changes to the calling conventions
77
6d3f9cfb » chipdude
2005-06-13 It's all new. All of it.
78 These bits of each flag word have common meanings for all argument/
79 return-value opcodes:
7dccda2b » Dan Sugalski
2003-11-17 Changes to the calling conventions
80
c410b60d » chipdude
2006-02-27 * Add two more TYPE, allowing for the unknown future.
81 0-3 TYPE
82 0b0000 = I
83 0b0001 = S
84 0b0010 = P
85 0b0011 = N
a40f31b6 » Dan Sugalski
2002-04-27 Added docs on Parrot's calling conventions.
86
c410b60d » chipdude
2006-02-27 * Add two more TYPE, allowing for the unknown future.
87 Don't set these bits yourself; the assembler will do it.
a40f31b6 » Dan Sugalski
2002-04-27 Added docs on Parrot's calling conventions.
88
49bf7e65 » allisonrandal
2009-02-08 [doc] Abandoning daft Perl 5-style documentation headings.
89 =head3 Passing Arguments, Returning Values
a40f31b6 » Dan Sugalski
2002-04-27 Added docs on Parrot's calling conventions.
90
8e58c2e3 » jhoblitt
2005-10-05 reformat all Pods under docs/pdds
91 Just before calling a subroutine with C<invokecc> or calling a method with
85e077d0 » paultcochrane
2007-09-11 [pdds] Minor formatting and textual corrections.
92 C<call_methodcc>, use the C<set_args> opcode to tell Parrot where the
8e58c2e3 » jhoblitt
2005-10-05 reformat all Pods under docs/pdds
93 subroutine's or method's arguments will come from and how they should be
94 expanded by the target.
7ed080df » Dan Sugalski
2002-08-08 Fixed the PMC parameter passing docs
95
7d2f0b57 » jkeenan
2008-04-03 Make PPD conform to coding standard for PDDs (https://rt.perl.org/rt3…
96 Similarly, just before returning from such a subroutine or method, use
97 the C<set_returns> opcode to tell Parrot where the return values will
98 come from and how to expand them for the caller's use.
7ed080df » Dan Sugalski
2002-08-08 Fixed the PMC parameter passing docs
99
49bf7e65 » allisonrandal
2009-02-08 [doc] Abandoning daft Perl 5-style documentation headings.
100 =head4 Flag Word Bits For 'Setting'
37a10ea7 » Dan Sugalski
2002-09-18 Some precursor changes
101
8e58c2e3 » jhoblitt
2005-10-05 reformat all Pods under docs/pdds
102 These bits of each flag word have these meanings specific to C<set_args> and
103 C<set_returns>:
37a10ea7 » Dan Sugalski
2002-09-18 Some precursor changes
104
82bee684 » ambs
2006-11-02 Changed pre-formatted text to standard POD. Now we can LaTeX it
105 =over 4
106
f40e752e » ambs
2006-11-03 Some more POD issues for printer-friendly LaTeX version
107 =item 4 C<CONSTANT>
82bee684 » ambs
2006-11-02 Changed pre-formatted text to standard POD. Now we can LaTeX it
108
109 The value is a literal constant, not a register. (Don't set this bit
110 yourself; the assembler will do it.)
111
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
112 =item 5 C<FLAT> (P only)
113
114 If this bit is set on a PMC value, then the PMC must be an aggregate. The
115 contents of the aggregate, rather than the aggregate itself, will be passed.
82bee684 » ambs
2006-11-02 Changed pre-formatted text to standard POD. Now we can LaTeX it
116
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
117 If the C<NAMED> bit is also set, the aggregate will be used as a hash; its
589e6437 » allisonrandal
2009-10-21 [cage] Some usage cleanup on "arguments" versus "parameters".
118 contents, as key/value pairs, will be passed as named arguments. The PMC
18f3b94a » Benabik
2012-01-26 Auto-replace TT# with GH# as per GH #707
119 must implement the full hash interface. {{ GH #252: Limit the required
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
120 interface. }}
82bee684 » ambs
2006-11-02 Changed pre-formatted text to standard POD. Now we can LaTeX it
121
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
122 If the C<NAMED> bit is not set, the aggregate will be used as an array; its
589e6437 » allisonrandal
2009-10-21 [cage] Some usage cleanup on "arguments" versus "parameters".
123 contents will be passed as positional arguments.
82bee684 » ambs
2006-11-02 Changed pre-formatted text to standard POD. Now we can LaTeX it
124
125 The meaning of this bit is undefined when applied to integer, number, and
126 string values.
127
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
128 =item 6 (unused)
82bee684 » ambs
2006-11-02 Changed pre-formatted text to standard POD. Now we can LaTeX it
129
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
130 =item 7 (unused)
82bee684 » ambs
2006-11-02 Changed pre-formatted text to standard POD. Now we can LaTeX it
131
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
132 =item 8 (unused)
f40e752e » ambs
2006-11-03 Some more POD issues for printer-friendly LaTeX version
133
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
134 =item 9 C<NAMED> (C<FLAT> or string constant only)
82bee684 » ambs
2006-11-02 Changed pre-formatted text to standard POD. Now we can LaTeX it
135
136 When the FLAT bit is also set, behavior is as described above in the "FLAT"
137 section. Otherwise, this bit may only be set on a unique string constant
138 specifying the name of the next argument (or returned value).
139
140 =back
a40f31b6 » Dan Sugalski
2002-04-27 Added docs on Parrot's calling conventions.
141
49bf7e65 » allisonrandal
2009-02-08 [doc] Abandoning daft Perl 5-style documentation headings.
142 =head3 Accepting Parameters, Accepting Return Values
a40f31b6 » Dan Sugalski
2002-04-27 Added docs on Parrot's calling conventions.
143
7d2f0b57 » jkeenan
2008-04-03 Make PPD conform to coding standard for PDDs (https://rt.perl.org/rt3…
144 As the I<first opcode> in a subroutine that will be called with
145 C<invokecc> or a method that will be called with C<call_methodcc>, use
146 the C<get_params> opcode to tell Parrot where the subroutine's or
147 method's arguments should be stored and how they should be expanded.
a40f31b6 » Dan Sugalski
2002-04-27 Added docs on Parrot's calling conventions.
148
7d2f0b57 » jkeenan
2008-04-03 Make PPD conform to coding standard for PDDs (https://rt.perl.org/rt3…
149 Similarly, just I<before> (yes, I<before>) calling such a subroutine or
150 method, use the C<get_results> opcode to tell Parrot where the return
151 values should be stored and how to expand them for your use.
a40f31b6 » Dan Sugalski
2002-04-27 Added docs on Parrot's calling conventions.
152
8e58c2e3 » jhoblitt
2005-10-05 reformat all Pods under docs/pdds
153 NOTE: It should be obvious, but in case it's not: You must name only registers
154 as targets of these opcodes, not constants. (You can't store anything into a
155 constant. That would make it a variable.)
a40f31b6 » Dan Sugalski
2002-04-27 Added docs on Parrot's calling conventions.
156
49bf7e65 » allisonrandal
2009-02-08 [doc] Abandoning daft Perl 5-style documentation headings.
157 =head4 Flag Word Bits For 'Getting'
a40f31b6 » Dan Sugalski
2002-04-27 Added docs on Parrot's calling conventions.
158
8e58c2e3 » jhoblitt
2005-10-05 reformat all Pods under docs/pdds
159 These bits of each flag word have these meanings specific to C<get_params> and
160 C<get_results>:
a40f31b6 » Dan Sugalski
2002-04-27 Added docs on Parrot's calling conventions.
161
82bee684 » ambs
2006-11-02 Changed pre-formatted text to standard POD. Now we can LaTeX it
162 =over 4
163
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
164 =item 4 (unused)
82bee684 » ambs
2006-11-02 Changed pre-formatted text to standard POD. Now we can LaTeX it
165
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
166 =item 5 C<SLURPY> (P only)
82bee684 » ambs
2006-11-02 Changed pre-formatted text to standard POD. Now we can LaTeX it
167
168 If this bit is set on a P register, then it will be populated with an
169 aggregate that will contain all of the remaining values that have not already
170 been stored in other registers.
171
172 All such values will be converted to PMCs according to the detailed rules
173 below, and those PMCs will be stored into the new aggregate.
174
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
175 If the C<NAMED> bit is also set, the aggregate will be the HLL-specific hash
589e6437 » allisonrandal
2009-10-21 [cage] Some usage cleanup on "arguments" versus "parameters".
176 type and the contents will be all unassigned _named_ arguments.
82bee684 » ambs
2006-11-02 Changed pre-formatted text to standard POD. Now we can LaTeX it
177
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
178 If the C<NAMED> bit is not set, the aggregate will be the HLL-specific array
589e6437 » allisonrandal
2009-10-21 [cage] Some usage cleanup on "arguments" versus "parameters".
179 type and the contents will be all unassigned positional arguments.
a40f31b6 » Dan Sugalski
2002-04-27 Added docs on Parrot's calling conventions.
180
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
181 =item 6 (unused)
82bee684 » ambs
2006-11-02 Changed pre-formatted text to standard POD. Now we can LaTeX it
182
f40e752e » ambs
2006-11-03 Some more POD issues for printer-friendly LaTeX version
183 =item 7 C<OPTIONAL>
82bee684 » ambs
2006-11-02 Changed pre-formatted text to standard POD. Now we can LaTeX it
184
185 If this bit is set on a register for which no value has been passed, no
186 exception will be raised; rather, the register will be set to a default value:
187 a Null PMC for P, an empty string for S, or zero for N or I.
188
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
189 =item 8 C<OPT_FLAG> (I only)
82bee684 » ambs
2006-11-02 Changed pre-formatted text to standard POD. Now we can LaTeX it
190
191 An I register with this bit set is set to one if the immediately preceding
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
192 B<OPTIONAL> register received a value; otherwise, it is set to zero. If the
193 preceding register was not marked B<OPTIONAL>, the behavior is undefined; but
194 we promise you won't like it.
82bee684 » ambs
2006-11-02 Changed pre-formatted text to standard POD. Now we can LaTeX it
195
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
196 =item 8 C<READONLY> (P only)
82bee684 » ambs
2006-11-02 Changed pre-formatted text to standard POD. Now we can LaTeX it
197
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
198 I<XXX - PROPOSED ONLY - XXX>
82bee684 » ambs
2006-11-02 Changed pre-formatted text to standard POD. Now we can LaTeX it
199
200 If this bit is set on a P register that receives a value, Parrot will ensure
201 that the final value in the P register is read-only (i.e. will not permit
202 modification). If the received value was a mutable PMC, then Parrot will
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
203 create and set the register to a {not yet invented} read-only PMC wrapper
204 around the original PMC.
82bee684 » ambs
2006-11-02 Changed pre-formatted text to standard POD. Now we can LaTeX it
205
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
206 Future Notes: Parrot's algorithm for deciding what is writable may be
207 simplistic. In initial implementations, it may assume that any PMC not of a
208 known read-only-wrapper type is mutable. Later it may allow the HLL to
209 provide the test. But we must beware overdesigning this; any HLL with a truly
210 complex notion of read-only probably needs to do this kind of wrapping itself.
82bee684 » ambs
2006-11-02 Changed pre-formatted text to standard POD. Now we can LaTeX it
211
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
212 =item 8 (unused for S and N)
213
214 =item 9 C<NAMED> (C<SLURPY> or string constant only)
82bee684 » ambs
2006-11-02 Changed pre-formatted text to standard POD. Now we can LaTeX it
215
216 When the SLURPY bit is also set, behavior is as described above in the
217 "SLURPY" section. Otherwise, this bit may only be set on a unique string
589e6437 » allisonrandal
2009-10-21 [cage] Some usage cleanup on "arguments" versus "parameters".
218 constant specifying the name of the next parameter (or returned value).
82bee684 » ambs
2006-11-02 Changed pre-formatted text to standard POD. Now we can LaTeX it
219
220 =back
a40f31b6 » Dan Sugalski
2002-04-27 Added docs on Parrot's calling conventions.
221
49bf7e65 » allisonrandal
2009-02-08 [doc] Abandoning daft Perl 5-style documentation headings.
222 =head4 Overflow and underflow
a40f31b6 » Dan Sugalski
2002-04-27 Added docs on Parrot's calling conventions.
223
ca0d5e6f » Bob Rogers
2008-01-06 + Expand description of current overflow/underflow behavior, explain
224 If too many or too few values are provided for the given target registers,
225 Parrot by default will throw an exception for C<get_params>, but not for
226 C<get_results>. This error behavior can be controlled via the C<errorson> and
227 C<errorsoff> opcodes using C<PARROT_ERRORS_PARAM_COUNT_FLAG> for C<get_params>
228 and C<PARROT_ERRORS_RESULT_COUNT_FLAG> for C<get_results>. (It is not
229 possible to control underflow behavior separately from overflow.)
a40f31b6 » Dan Sugalski
2002-04-27 Added docs on Parrot's calling conventions.
230
ca0d5e6f » Bob Rogers
2008-01-06 + Expand description of current overflow/underflow behavior, explain
231 Note that if the final target is a P register with FLAT set, then overflow can
232 never occur. Similarly, if all target registers are marked B<OPTIONAL>, then
233 underflow is impossible.
a40f31b6 » Dan Sugalski
2002-04-27 Added docs on Parrot's calling conventions.
234
ca0d5e6f » Bob Rogers
2008-01-06 + Expand description of current overflow/underflow behavior, explain
235 Note also that when these errors are off, any excess destination registers in
236 the case of underflow are left untouched, rather than being reset to zero or
237 null. Excess registers explicitly marked B<OPTIONAL> are always reset,
238 regardless of the error flag settings.
a40f31b6 » Dan Sugalski
2002-04-27 Added docs on Parrot's calling conventions.
239
49bf7e65 » allisonrandal
2009-02-08 [doc] Abandoning daft Perl 5-style documentation headings.
240 =head4 Ordering of named values (outgoing)
c410b60d » chipdude
2006-02-27 * Add two more TYPE, allowing for the unknown future.
241
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
242 Named values (arguments, or values to return) must be listed textually after
243 all the positional values. C<FLAT> and non-C<FLAT> values may be mixed in any
244 order.
c410b60d » chipdude
2006-02-27 * Add two more TYPE, allowing for the unknown future.
245
49bf7e65 » allisonrandal
2009-02-08 [doc] Abandoning daft Perl 5-style documentation headings.
246 =head4 Ordering of named targets (incoming)
c410b60d » chipdude
2006-02-27 * Add two more TYPE, allowing for the unknown future.
247
248 Named targets (parameters, or returned values) must appear I<after> all the
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
249 positional targets. A C<SLURPY> positional target, if present, must be the
250 last positional target; a C<SLURPY> named target, if present, must be the last
251 named target.
c410b60d » chipdude
2006-02-27 * Add two more TYPE, allowing for the unknown future.
252
253 So the acceptable ordering of targets is:
254
255 =over 4
256
257 =item *
258
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
259 positional non-SLURPY (any number)
c410b60d » chipdude
2006-02-27 * Add two more TYPE, allowing for the unknown future.
260
261 =item *
262
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
263 positional SLURPY array (optional)
c410b60d » chipdude
2006-02-27 * Add two more TYPE, allowing for the unknown future.
264
265 =item *
266
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
267 NAMED non-SLURPY (any number)
c410b60d » chipdude
2006-02-27 * Add two more TYPE, allowing for the unknown future.
268
269 =item *
270
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
271 NAMED SLURPY hash (optional)
c410b60d » chipdude
2006-02-27 * Add two more TYPE, allowing for the unknown future.
272
273 =back
274
49bf7e65 » allisonrandal
2009-02-08 [doc] Abandoning daft Perl 5-style documentation headings.
275 =head4 Mixing named and positional values
c410b60d » chipdude
2006-02-27 * Add two more TYPE, allowing for the unknown future.
276
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
277 Positional targets can only be filled with positional values.
c410b60d » chipdude
2006-02-27 * Add two more TYPE, allowing for the unknown future.
278
85e077d0 » paultcochrane
2007-09-11 [pdds] Minor formatting and textual corrections.
279 Named targets can be filled with either positional or named values.
280 However, if a named target was already filled by a positional value, and
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
281 then a named value is also given, this is an overflow error.
c410b60d » chipdude
2006-02-27 * Add two more TYPE, allowing for the unknown future.
282
49bf7e65 » allisonrandal
2009-02-08 [doc] Abandoning daft Perl 5-style documentation headings.
283 =head4 Type Conversions
6d3f9cfb » chipdude
2005-06-13 It's all new. All of it.
284
8e58c2e3 » jhoblitt
2005-10-05 reformat all Pods under docs/pdds
285 Unlike the C<set_*> opcodes, the C<get_*> opcodes must perform conversion from
286 one register type to another. Here are the conversion rules:
898b4d2d » Dan Sugalski
2004-11-16 Final release version of pdd03
287
288 =over 4
289
6d3f9cfb » chipdude
2005-06-13 It's all new. All of it.
290 =item *
898b4d2d » Dan Sugalski
2004-11-16 Final release version of pdd03
291
6d3f9cfb » chipdude
2005-06-13 It's all new. All of it.
292 When the target is an I, N, or S register, storage will behave like an
293 C<assign> (standard conversion).
898b4d2d » Dan Sugalski
2004-11-16 Final release version of pdd03
294
6d3f9cfb » chipdude
2005-06-13 It's all new. All of it.
295 =item *
898b4d2d » Dan Sugalski
2004-11-16 Final release version of pdd03
296
8e58c2e3 » jhoblitt
2005-10-05 reformat all Pods under docs/pdds
297 When the target and source are both P registers, storage will behave like a
298 C<set> (pass by reference).
898b4d2d » Dan Sugalski
2004-11-16 Final release version of pdd03
299
6d3f9cfb » chipdude
2005-06-13 It's all new. All of it.
300 =item *
898b4d2d » Dan Sugalski
2004-11-16 Final release version of pdd03
301
0abc6ea3 » chipdude
2005-11-30 Bring pdd03 out of clip purgatory.
302 When the target is a P register and the source is an integer, the P will be
757c9370 » chromatic
2007-08-30 [OO] Changed more PMC creation from constant syntax to string style.
303 set to a new Integer[1] which has been C<assign>ed the given integer.
898b4d2d » Dan Sugalski
2004-11-16 Final release version of pdd03
304
6d3f9cfb » chipdude
2005-06-13 It's all new. All of it.
305 =item *
898b4d2d » Dan Sugalski
2004-11-16 Final release version of pdd03
306
8e58c2e3 » jhoblitt
2005-10-05 reformat all Pods under docs/pdds
307 When the target is a P register and the source is a number, the P will be set
757c9370 » chromatic
2007-08-30 [OO] Changed more PMC creation from constant syntax to string style.
308 to a new Float[1] which has been C<assign>ed the given number.
898b4d2d » Dan Sugalski
2004-11-16 Final release version of pdd03
309
6d3f9cfb » chipdude
2005-06-13 It's all new. All of it.
310 =item *
898b4d2d » Dan Sugalski
2004-11-16 Final release version of pdd03
311
8e58c2e3 » jhoblitt
2005-10-05 reformat all Pods under docs/pdds
312 When the target is a P register and the source is a string, the P will be set
757c9370 » chromatic
2007-08-30 [OO] Changed more PMC creation from constant syntax to string style.
313 to a new String[1] which has been C<assign>ed the given string.
898b4d2d » Dan Sugalski
2004-11-16 Final release version of pdd03
314
315 =back
316
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
317 [1] or some other type specified by the current HLL type map, which may
318 substitute an alternative type for each default low-level Parrot type (array,
319 hash, string, number, etc.).
5b3d0e65 » Leopold Toetsch
2005-12-27 update pdd03 to better reflect current state
320
49bf7e65 » allisonrandal
2009-02-08 [doc] Abandoning daft Perl 5-style documentation headings.
321 =head2 Implementation
7d2f0b57 » jkeenan
2008-04-03 Make PPD conform to coding standard for PDDs (https://rt.perl.org/rt3…
322
323 Not applicable.
324
49bf7e65 » allisonrandal
2009-02-08 [doc] Abandoning daft Perl 5-style documentation headings.
325 =head2 Bugs
898b4d2d » Dan Sugalski
2004-11-16 Final release version of pdd03
326
6d3f9cfb » chipdude
2005-06-13 It's all new. All of it.
327 Required features are missing:
898b4d2d » Dan Sugalski
2004-11-16 Final release version of pdd03
328
6d3f9cfb » chipdude
2005-06-13 It's all new. All of it.
329 =over 4
6ef54718 » Dan Sugalski
2003-06-21 Added null ops to core.ops
330
6d3f9cfb » chipdude
2005-06-13 It's all new. All of it.
331 =item *
6ef54718 » Dan Sugalski
2003-06-21 Added null ops to core.ops
332
6d3f9cfb » chipdude
2005-06-13 It's all new. All of it.
333 Specific exceptions to throw for specific errors.
334
335 =back
336
49bf7e65 » allisonrandal
2009-02-08 [doc] Abandoning daft Perl 5-style documentation headings.
337 =head2 PIR Syntax Examples
c410b60d » chipdude
2006-02-27 * Add two more TYPE, allowing for the unknown future.
338
49bf7e65 » allisonrandal
2009-02-08 [doc] Abandoning daft Perl 5-style documentation headings.
339 =head3 Function Calls
c410b60d » chipdude
2006-02-27 * Add two more TYPE, allowing for the unknown future.
340
6e05a06c » coke
2009-05-16 [docs] Mark & test more pasm/pir.
341 =begin PIR_FRAGMENT_INVALID
342
343 .local pmc foo, i, ar, y, p, value, kw, a, b, c, z
344 # ...
c410b60d » chipdude
2006-02-27 * Add two more TYPE, allowing for the unknown future.
345 foo(1, i) # 2 positional arguments
346 foo(x, ar :flat, y) # flattening array
d5305a0b » particle
2006-10-13 [PDD03[: clarify examples for :named syntax
347 foo(p, 'key' => value) # named argument
348 foo(p, value :named('key')) # the same
33fc8c54 » Leopold Toetsch
2006-05-11 pdd03 typo
349 foo(kw :named :flat) # a flattening hash
c410b60d » chipdude
2006-02-27 * Add two more TYPE, allowing for the unknown future.
350
1aa4e608 » chipdude
2006-11-10 Remove the :maybe_flat "feature", which was intended to help Perl 6, but
351 # all together now: three positional (one flat) with two named (one flat)
352 foo(a, b, c :flat, 'x' => 3, 'y' => 4, z :flat :named('z'))
353
6e05a06c » coke
2009-05-16 [docs] Mark & test more pasm/pir.
354 =end PIR_FRAGMENT_INVALID
355
49bf7e65 » allisonrandal
2009-02-08 [doc] Abandoning daft Perl 5-style documentation headings.
356 =head3 Parameters
c410b60d » chipdude
2006-02-27 * Add two more TYPE, allowing for the unknown future.
357
6e05a06c » coke
2009-05-16 [docs] Mark & test more pasm/pir.
358 =begin PIR
359
360 .sub foo
361 .param int i # positional parameter
362 .param pmc argv :slurpy # slurpy array
363 .param pmc value :named('key') # named parameter
364 .param int x :optional # optional parameter
365 .param int has_x :opt_flag # flag 0/1 x was passed
366 .param pmc kw :slurpy :named # slurpy hash
367 # ...
368 .end
369
370 =end PIR
c410b60d » chipdude
2006-02-27 * Add two more TYPE, allowing for the unknown future.
371
49bf7e65 » allisonrandal
2009-02-08 [doc] Abandoning daft Perl 5-style documentation headings.
372 =head3 Return Values
c410b60d » chipdude
2006-02-27 * Add two more TYPE, allowing for the unknown future.
373
6e05a06c » coke
2009-05-16 [docs] Mark & test more pasm/pir.
374 =begin PIR_INVALID
375
376 .sub foo
377 .local pmc i, ar, value
378 .return (i, ar: flat, value :named('key') )
379 .end
380
381 =end PIR_INVALID
c410b60d » chipdude
2006-02-27 * Add two more TYPE, allowing for the unknown future.
382
49bf7e65 » allisonrandal
2009-02-08 [doc] Abandoning daft Perl 5-style documentation headings.
383 =head3 Call Results
c410b60d » chipdude
2006-02-27 * Add two more TYPE, allowing for the unknown future.
384
6e05a06c » coke
2009-05-16 [docs] Mark & test more pasm/pir.
385 =begin PIR_FRAGMENT
386
387 .local pmc x, foo, i, j, ar, value
c410b60d » chipdude
2006-02-27 * Add two more TYPE, allowing for the unknown future.
388 x = foo() # single result
d5305a0b » particle
2006-10-13 [PDD03[: clarify examples for :named syntax
389 (i, j :optional, ar :slurpy, value :named('key') ) = foo()
6ef54718 » Dan Sugalski
2003-06-21 Added null ops to core.ops
390
6e05a06c » coke
2009-05-16 [docs] Mark & test more pasm/pir.
391 =end PIR_FRAGMENT
392
49bf7e65 » allisonrandal
2009-02-08 [doc] Abandoning daft Perl 5-style documentation headings.
393 =head2 References
ef9e57c5 » Michael Scott
2004-02-28 tidy up pdds
394
fba2bc19 » coke
2010-04-14 PDD cleanup (TT #1536); Remove maintainer, changes sections.
395 F<pdd23_exceptions.pod>
ef9e57c5 » Michael Scott
2004-02-28 tidy up pdds
396
0abc6ea3 » chipdude
2005-11-30 Bring pdd03 out of clip purgatory.
397 =cut
f140bda7 » chipdude
2005-11-30 Formatting: standardize word wrap at column 78.
398
0abc6ea3 » chipdude
2005-11-30 Bring pdd03 out of clip purgatory.
399 __END__
400 Local Variables:
401 fill-column:78
402 End:
Something went wrong with that request. Please try again.