Skip to content
Newer
Older
100644 1020 lines (674 sloc) 29.4 KB
741e884 Added cat and the infix form of zip (Unicode and ASCII). For this, I …
ajs authored
1 =encoding utf8
2
04840a3 [Spec] treat all authors equally
lwall authored
3 =head1 TITLE
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
4
5223afc [docs/Perl6/Spec/Functions.pod]
agentz authored
5 Synopsis 29: Builtin Functions
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
6
5da63dc @lucasbuchala Small POD and typographical fixes
lucasbuchala authored
7 =head1 VERSION
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
8
04840a3 [Spec] treat all authors equally
lwall authored
9 Created: 12 Mar 2005
10
d251a6b @labster unspec quotemeta, fixes #89
labster authored
11 Last Modified: 24 April 2015
12 Version: 63
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
13
f185747 [S29] changed outdated notice about document location, noticed by Coke++
moritz authored
14 The document is a draft.
15
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
16 =head1 Notes
17
b22582e 1st whack at exporting methods.
lwall authored
18 In Perl 6, all builtin functions belong to a named package (generally a
19 class or role). Not all
ddbf48d name whackage of various sorts
lwall authored
20 functions are guaranteed to be imported into the CORE scope.
21 In addition, the list of functions imported into C<CORE> will be
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
22 subject to change with each release of Perl. Authors wishing to
23 "Future Proof" their code should either specifically import the
24 functions they will be using, or always refer to the functions by their
25 full name.
26
27 After 6.0.0 comes out, global aliases will not be removed lightly,
28 and will never be removed at all without having gone through a
29 deprecation cycle of at least a year. In any event, you can specify
30 that you want the interface for a particular version of Perl, and
31 that can be emulated by later versions of Perl to the extent that
32 security updates allow.
33
34 Where code is given here, it is intended to define semantics, not to
35 dictate implementation.
36
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
37 =head2 Operators vs. Functions
38
39 There is no particular difference between an operator and a function,
40 but for the sake of documentation, only functions declared without
41 specifying a grammatical category or with a category of C<term:>
81d7a89 [docs/Perl6/Spec]
agentz authored
42 (see L<S02/"Bits and Pieces">) will be described as "functions",
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
43 and everything else as "operators" which are outside of the scope
ddbf48d name whackage of various sorts
lwall authored
44 of this document. (See S03 for operators.)
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
45
b22582e 1st whack at exporting methods.
lwall authored
46 =head2 Multis vs. Functions
47
d426c8b Note that multies aren't automatically global but are imported by Pre…
lwall authored
48 In actual fact, most of the "functions" defined here are multi
49 subs, or are multi methods that are also exported as multi subs.
ddbf48d name whackage of various sorts
lwall authored
50 The Setting is responsible for importing all the standard multi subs
51 from their various packages into the CORE lexical scope. See S02.
b22582e 1st whack at exporting methods.
lwall authored
52
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
53 =head1 Type Declarations
54
55 The following type declarations are assumed:
56
57 =over
58
b22582e 1st whack at exporting methods.
lwall authored
59 =item Matcher
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
60
c8f2dcc @TimToady Failed matches to return Nil, not (Match)
TimToady authored
61 subset Matcher of Mu where * !=== any(Bool,Match,Nil)
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
62
63 Used to supply a test to match against. Assume C<~~> will be used against it.
3d430cb [S29] restrict Matcher from taking Bool
lwall authored
64 Booleans are forbidden because they almost always indicate a programming
65 error where the argument has been evaluated too soon against the wrong C<$_>.
66 For instance:
67
68 grep $_ == 1, 1,2,3; # evaluating wrong $_, so forbidden
69 grep { $_ == 1 }, 1,2,3; # okay
70 grep * == 1, 1,2,3; # okay
71
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
72
f556581 [docs/Perl6/Spec/Functions.pod]
lanny authored
73 =item Ordering
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
74
0d55ac5 - Standardised on .signature vs. .sig
wayland authored
75 subset KeyExtractor of Code where { .signature === :(Any --> Any) };
76 subset Comparator of Code where { .signature === :(Any, Any --> Int ) };
f556581 [docs/Perl6/Spec/Functions.pod]
lanny authored
77 subset OrderingPair of Pair where { .left ~~ KeyExtractor && .right ~~ Comparator };
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
78
f4dbd60 [S29] expand on use of * in orderings
lwall authored
79 subset Ordering where Signature | KeyExtractor | Comparator | OrderingPair | Whatever;
f556581 [docs/Perl6/Spec/Functions.pod]
lanny authored
80
81 Used to handle comparisons between things. Generally this
aa215cb [S29, S32] removed eqv() and cmp() functions
masak authored
82 ends up in functions like C<sort()>,
f556581 [docs/Perl6/Spec/Functions.pod]
lanny authored
83 C<min()>, C<max()>, etc., as a $by parameter which provides
84 the information on how two things compare relative to each other.
85
86 =over
87
88 =item Comparator
89
90 A closure with arity of 2, which for ordering returns
91 negative/zero/positive, signaling the first argument should
92 be before/tied with/after the second. aka "The Perl 5 way".
93
94 For equivalence the closure returns either not 0 or 0 indicating
95 if the first argument is equivalent or not to the second.
96
97 =item KeyExtractor
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
98
f556581 [docs/Perl6/Spec/Functions.pod]
lanny authored
99 A closure with arity of 1, which returns the "key" by which
100 to compare. Values are compared using C<cmp> for orderings
101 and C<eqv> for equivalences, which in Perl 6 do different
102 comparisons depending on the types. (To get a Perl 5 string
103 ordering you must compare with C<leg> instead.)
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
104
f556581 [docs/Perl6/Spec/Functions.pod]
lanny authored
105 Internally the result of the KeyExtractor on a value should
106 be cached.
107
f4dbd60 [S29] expand on use of * in orderings
lwall authored
108 Note that it is very easy to generate a simple C<KeyExtractor>
109 using C<~*> for strings and C<+*> for numbers, since with most
110 simple operators C<*> returns a closure of one argument.
111
112 @sorted = sort +*, @unsorted; #ascending numeric
113 @sorted = sort -*, @unsorted; #descending numeric
114
f556581 [docs/Perl6/Spec/Functions.pod]
lanny authored
115 =item OrderingPair
116
117 A combination of the two methods above, for when one wishes
118 to take advantage of the internal caching of keys that is
119 expected to happen, but wishes to compare them with something
120 other than C<eqv> or C<cmp>, such as C<E<lt>=E<gt>> or C<leg>.
121
122 =item Signature
123
124 If a signature is specified as a criterion, the signature is
125 bound to each value and then each parameter does comparisons
126 in positional order according to its type, as modified by
127 its traits. Basically, the system will write the body of
128 the key extraction and comparison subroutine for you based on
129 the signature.
130
131 For ordering the list of positional parameter comparisons is
132 reduced as if using [||] but all comparisons do not need to be
133 performed if an early one determines an increasing or decreasing
134 order. For equivalence the list is reduced as if using [&&].
135
f4dbd60 [S29] expand on use of * in orderings
lwall authored
136 =item Whatever
137
138 An ordering of C<*> does the default comparison for the operator:
139
140 @sorted = sort *, @unsorted;
141
f556581 [docs/Perl6/Spec/Functions.pod]
lanny authored
142 =back
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
143
e672426 [docs/Perl6/Spec/Functions.pod]
agentz authored
144 =back
145
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
146 =head1 Function Packages
147
9b4ea89 Carry over @ vs @@ contextualization to zip and Z and map.
lwall authored
148 =head2 Context
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
149
150 =over
151
7c79cd8 Removed some of the ugly bits and constants from Math::Basic, to the …
ajs authored
152 =item caller
153
dff2364 [Spec] slaughter various confusing overloadings of the term 'context'
lwall authored
154 See L<S06/"The C<callframe> and C<caller> functions">.
7c79cd8 Removed some of the ugly bits and constants from Math::Basic, to the …
ajs authored
155
dff2364 [Spec] slaughter various confusing overloadings of the term 'context'
lwall authored
156 =item callframe
bd2bd5e More masak-inspired changes.
wayland authored
157
dff2364 [Spec] slaughter various confusing overloadings of the term 'context'
lwall authored
158 See L<S06/"The C<callframe> and C<caller> functions">.
bd2bd5e More masak-inspired changes.
wayland authored
159
0b7df09 @TimToady rename eval to EVAL to indicate specialness
TimToady authored
160 =item EVAL
81d7a89 [docs/Perl6/Spec]
agentz authored
161
0b7df09 @TimToady rename eval to EVAL to indicate specialness
TimToady authored
162 macro EVAL ( Str|Buf $code, Grammar :$lang = CALLER::<$?PARSER>)
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
163
3c1f3f7 @paultcochrane Purge trailing whitespace in S21 -- S99
paultcochrane authored
164 Execute C<$code> as if it were code written in C<$lang>. If C<$code>
f55b3f9 [S29] document eval(Buf)
moritz authored
165 is of type C<Buf>, the same decoding techniques are applied as a compiler
166 for C<$lang> would usually do to input files.
167
168 The default for C<$lang> is the language in effect at the exact
0b7df09 @TimToady rename eval to EVAL to indicate specialness
TimToady authored
169 location of the C<EVAL> call.
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
170
e84b111 @moritz eval() does not catch exceptions
moritz authored
171 Returns whatever C<$code> returns, or fails when the compilation fails.
172
0b7df09 @TimToady rename eval to EVAL to indicate specialness
TimToady authored
173 Note that unlike in Perl 5's C<eval>, C<EVAL> does not catch any exceptions or control
e84b111 @moritz eval() does not catch exceptions
moritz authored
174 exceptions.
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
175
a1a7745 @jnthn s/evalfile/EVALFILE/, for consistency with EVAL.
jnthn authored
176 =item EVALFILE
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
177
a1a7745 @jnthn s/evalfile/EVALFILE/, for consistency with EVAL.
jnthn authored
178 multi EVALFILE (Str $filename ; Grammar :$lang = Perl6)
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
179
180 Behaves like, and replaces Perl 5 C<do EXPR>, with optional C<$lang>
181 support.
182
81d7a89 [docs/Perl6/Spec]
agentz authored
183 =item exit
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
184
9b4ea89 Carry over @ vs @@ contextualization to zip and Z and map.
lwall authored
185 multi exit (Int $status = 0)
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
186
187 Stops all program execution, and returns C<$status> to the calling environment.
188
cdb1b72 @TimToady spec exit at least as well as rosettacode does :)
TimToady authored
189 An exit runs all appropriate scope-leaving blocks such as C<LEAVE>, C<KEEP>,
32d0ad7 @lizmat Revert "Get rid of DESTROY fossils"
lizmat authored
190 and C<UNDO>, followed by all C<END> blocks, followed by all C<DESTROY>s that
191 do more than just reclaim memory, and so cannot be skipped because
cdb1b72 @TimToady spec exit at least as well as rosettacode does :)
TimToady authored
192 they may have side effects visible outside the process. If run from
193 an embedded interpreter, all memory must also be reclaimed.
194
8b6d0bb @lizmat Elaborate a bit on exit, END blocks and threads
lizmat authored
195 Exit can also be called from an C<END> block: in that case only the C<$status>
196 to be returned to the calling environment, is changed. This does end the
197 execution of the END block in question, but will still execute any remaining
198 C<END> blocks.
199
200 Any threads started with the C<:app_lifetime> parameter (which is basically
201 any asynchronous action started with primitives other than C<Thread.new>),
202 will be terminated on exit.
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
203
204 =item sleep
205
042527b @TimToady Only the basic sleep supports sleeping forever.
TimToady authored
206 multi sleep ( Real $for --> Nil )
207 multi sleep ( Whatever --> Nil )
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
208
042527b @TimToady Only the basic sleep supports sleeping forever.
TimToady authored
209 Attempt to sleep for up to C<$for> seconds, or forever when the argument is C<*>.
210 Implementations are obligated
fcd17ad @TimToady split sleep() into three functions
TimToady authored
211 to support sub-second resolutions if that is at all possible. You may pass
212 any of C<Int>, C<Num>, C<Rat>, or C<Duration> types as an argument, since those
213 all do C<Real>, but regardless of which type you use, they are always scaled to
214 seconds. (An implementation is allowed to provide access to a platform-specific
215 function based on, say, nanoseconds, but Perl 6 does not presume to know
216 how much resolution clocks will have in the future, so requires everything to
217 be specified in fractional seconds.)
218
219 This function returns nothing; use C<sleep-timer> if you wish it to
220 return how much time is remaining on the specified sleep. However,
221 if you really just want to keep rolling over in bed until your alarm
222 goes off at a particular time, use C<sleep-till> instead, since it
223 is not subject to relative clock drift.
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
224
042527b @TimToady Only the basic sleep supports sleeping forever.
TimToady authored
225 All of these sleep functions work only on the current thread.
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
226
fcd17ad @TimToady split sleep() into three functions
TimToady authored
227 =item sleep-timer
228
6440475 @TimToady remove pasto defaults to sleep variants
TimToady authored
229 multi sleep-timer ( Real $for --> Duration )
fcd17ad @TimToady split sleep() into three functions
TimToady authored
230
231 Just like C<sleep>, but returns the amount of time remaining to sleep
232 as a C<Duration> (which will be 0 if the call was not interrupted).
233 Depending on the platform and the system call involved, this may or
234 may not require emulation by interrogating the clock before and after.
235 For those systems whose system call returns the remaining time, this
236 can be more efficient than interrogating the clock twice yourself,
237 However, the optimizer is encouraged to change this to a bare C<sleep>
238 in sink context. (But then, you might as well just write that in
239 the first place.)
240
241 =item sleep-till
242
6440475 @TimToady remove pasto defaults to sleep variants
TimToady authored
243 multi sleep-till ( Instant $till --> Bool )
fcd17ad @TimToady split sleep() into three functions
TimToady authored
244
245 Just like C<sleep>, but checks the current time and goes back to
246 sleep if accidentally woken up early, to guarantee waiting until the
7e9c2b6 @TimToady merge interval and sleep-till to one function
TimToady authored
247 specified time. Returns True if the function actually waited, or if
248 the specified time happens to be the present moment. Returns False
249 if you asked to sleep until a time in the past.
a8ed7cf @lizmat Specify "interval" function
lizmat authored
250
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
251 =item die
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
252
b3ec3ab [Spec/S29-functions.pod] Added some details about die and fail
carlin authored
253 multi die (@LIST)
254
3767644 [Spec/S29-functions.pod] Fixed mistake with 'die'. carlin--, masak++
carlin authored
255 Throws a fatal Exception. The default exception handler prints each element of
256 the list to $*ERR (STDERR).
b3ec3ab [Spec/S29-functions.pod] Added some details about die and fail
carlin authored
257
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
258 =item fail
259
b3ec3ab [Spec/S29-functions.pod] Added some details about die and fail
carlin authored
260 multi fail (Str $message)
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
261
b3ec3ab [Spec/S29-functions.pod] Added some details about die and fail
carlin authored
262 Can only be called inside a routine and causes the routine to C<return> an
263 unthrown exception; a C<Failure> object which stringifies to C<$message>.
264 If C<use fatal> is in effect where the routine was called from, it throws
265 the exception.
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
266
267 =back
268
269
270 =head2 Conversions
271
272 =over
273
81d7a89 [docs/Perl6/Spec]
agentz authored
274 =item bless
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
275
de909c2 @TimToady simplify blessing
TimToady authored
276 method bless(*@protos, *%init_args )
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
277
b4c6aab [S29-functions] chasing spec changes to C<bless>
masak authored
278 Calling C<bless> on any invocant (but typically a type object) to create a new
279 object with the same class as the invocant.
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
280
2338ed1 @lizmat Attempt at clarification 1st parameter to .bless
lizmat authored
281 The C<.bless> method takes the first positional argument indicating a
282 candidate to bless. If absent, the object builder implicitly asks the
283 representation what its preferred, er, representation is.
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
284
de909c2 @TimToady simplify blessing
TimToady authored
285 C<bless> automatically creates an object appropriate to the
286 representation of the class, then calls all appropriate C<BUILD>
287 routines for the current class, which initializes the object in
288 least-derived to most-derived order. See L<S12/Objects> for more
289 detailed information on object creation.
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
290
b578b58 @TimToady Distinguish listy ords/chrs from ord/chr
TimToady authored
291 =item chrs
292
293 =item ords
294
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
295 =item chr
296
297 =item ord
298
995ad12 @TimToady braino noticed by Eirik++
TimToady authored
299 multi sub chrs( Int *@grid --> Str )
b578b58 @TimToady Distinguish listy ords/chrs from ord/chr
TimToady authored
300 multi method ords( Str $string: --> List of Int ) is export
af82a6f @ShimmerFairy Remove ancient string types
ShimmerFairy authored
301 multi method chr( Int $grid: --> Str ) is export
15242ee [S29-functions] fix some misplaced types
lwall authored
302 multi method ord( Str $string: --> Int ) is export
ccfe539 [Functions] did away with the Uni type
lwall authored
303
b578b58 @TimToady Distinguish listy ords/chrs from ord/chr
TimToady authored
304 C<chrs> takes zero or more integer grapheme ids and returns the
ccfe539 [Functions] did away with the Uni type
lwall authored
305 corresponding characters as a string. If any grapheme id is used
306 that represents a higher abstraction level than the current
307 lexical scope supports, that grapheme is converted to the
308 corresponding lower-level string of codepoints/bytes that would
dff2364 [Spec] slaughter various confusing overloadings of the term 'context'
lwall authored
309 be appropriate to the current pragmatic context, just as any other Str
ccfe539 [Functions] did away with the Uni type
lwall authored
310 would be downgraded in context.
311
b578b58 @TimToady Distinguish listy ords/chrs from ord/chr
TimToady authored
312 C<ords> goes the other direction; it takes a string value and returns
313 character values as integers. The definition of character is pragma dependent.
ccfe539 [Functions] did away with the Uni type
lwall authored
314 Normally it's a grapheme id, but under codepoints or bytes scopes,
315 the string is coerced to the appropriate low-level view and interpreted
316 as codepoints or bytes. Hence, under "use bytes" you will never see a
aa6f243 @lizmat Unprecomposed graphemes are < 0, not > 0x10ffff
lizmat authored
317 value larger than 256, and under "use codepoints" you will probably never see a
ccfe539 [Functions] did away with the Uni type
lwall authored
318 value larger than 0x10ffff. The only guarantee under "use graphemes"
319 (the default) is that the number returned will correspond to the
320 codepoint of the precomposed codepoint representing the grapheme, if
321 there is such a codepoint. Otherwise, the implementation is free to
aa6f243 @lizmat Unprecomposed graphemes are < 0, not > 0x10ffff
lizmat authored
322 return any negative unique 32-bit id. (The C<chr> function
ccfe539 [Functions] did away with the Uni type
lwall authored
323 will know how to backtranslate such ids properly to codepoints or
dff2364 [Spec] slaughter various confusing overloadings of the term 'context'
lwall authored
324 bytes in any context. Note that we are assuming that every codepoint's
325 context knows its normalization preferences, and every byte's context
ccfe539 [Functions] did away with the Uni type
lwall authored
326 also knows its encoding preferences. (These are knowable in the
327 lexical scope via the $?NF and $?ENC compile-time constants).)
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
328
b578b58 @TimToady Distinguish listy ords/chrs from ord/chr
TimToady authored
329 The C<chr> and C<ord> variants are restricted to processing a single
330 character. As is customary, you may pass a longer string to C<ord>,
331 but only the first character will be translated.
332
1b62953 [S29] added slice and hash contextualizers, reordered item and list
masak authored
333 =item item
334
6967af1 @TimToady bloodbath to remove bogus 'our' declarations
TimToady authored
335 multi item ( $item --> Item )
1b62953 [S29] added slice and hash contextualizers, reordered item and list
masak authored
336
337 Forces generic Item context on its argument, and returns it.
338
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
339 =item list
340
6967af1 @TimToady bloodbath to remove bogus 'our' declarations
TimToady authored
341 multi list ( Iterable $item --> List ) { $item.iterator.list }
eb862b2 @japhb Banish |$ and \$ in more places
japhb authored
342 multi list ( List \iter --> List ) { iter }
912d5a4 [S29] more @@ and iterator patchups
lwall authored
343
344 Almost a no-op; just makes sure that $item can be iterated.
345
346 =item flat
347
6967af1 @TimToady bloodbath to remove bogus 'our' declarations
TimToady authored
348 multi flat ( *@list --> List )
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
349
22c73b2 [S29] syntaxos (grammaros?) (spellos?) (typos?)
diakopter authored
350 Forces flat context on its arguments, and returns them.
912d5a4 [S29] more @@ and iterator patchups
lwall authored
351 The heavy work is done by the C<*@> binding.
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
352
60864d9 @TimToady fossil slice contextualizer -> lol
TimToady authored
353 =item lol
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
354
6967af1 @TimToady bloodbath to remove bogus 'our' declarations
TimToady authored
355 multi lol ( **@list --> List )
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
356
60864d9 @TimToady fossil slice contextualizer -> lol
TimToady authored
357 Forces the argument list to be evaluated in lol ("list of lists") context.
358 (Subscripts treat such a list of lists as a multidimensional slice.)
eb42709 @TimToady remove mentions of Parcel/parcel
TimToady authored
359 Any sublist within the top level of the outer list will be transformed into an item (Scalar).
912d5a4 [S29] more @@ and iterator patchups
lwall authored
360 The work is actually done by the binding to the C<**@> parameter.
977e82f @TimToady respec tree to default to all levels
TimToady authored
361 See also the more general C<.tree> method, which defaults to itemizing every level.
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
362
1b62953 [S29] added slice and hash contextualizers, reordered item and list
masak authored
363 =item hash
364
365 The C<hash> contextualizer
366
6967af1 @TimToady bloodbath to remove bogus 'our' declarations
TimToady authored
367 multi hash ( *@list --> Hash )
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
368
1b62953 [S29] added slice and hash contextualizers, reordered item and list
masak authored
369 Forces the argument list to be evaluated in hash context.
370 The expression is evaluated in list context (flattening any C<Capture>s),
371 then a hash will be created from the list, taken as a list of C<Pair>s.
372 (Any element in the list that is not a C<Pair> will pretend to be a key
373 and grab the next value in the list as its value.) Equivalent to
374 C<%()> (except that empty C<%()> means C<%($/)>, while
375 empty C<hash()> means an empty hash).
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
376
0a75c8b @TimToady document gist better
TimToady authored
377 =item gist
378
eb862b2 @japhb Banish |$ and \$ in more places
japhb authored
379 multi gist( |item --> Str )
6967af1 @TimToady bloodbath to remove bogus 'our' declarations
TimToady authored
380 multi method gist( Mu $item: --> Str )
0a75c8b @TimToady document gist better
TimToady authored
381
382 Produces an informal string coercion, something a human might want
383 to see if debugging, for instance. Each type may decide its own
384 gist representation. C<Mu.gist> just calls C<.perl>, but any type's
385 C<gist> method may override this to remove metainfo that a human
386 would find to be cluttery or redundant, or to format a composite value
387 with suitable whitespace to tell the bits apart, or to trim down an
388 infinite list to something slightly shorter.
389
390 C<gist> is used as a last-ditch string coercion on each individual
391 argument of various human-facing output routines, specifically
392 C<say>, C<note>, C<warn>, and any non-exceptional arguments to C<die>.
393 The C<print> function is specifically excluded, since it's outputting
394 to a printer. C<:-)>
395
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
396 =item :16, :8, :2, :10
81d7a89 [docs/Perl6/Spec]
agentz authored
397
6967af1 @TimToady bloodbath to remove bogus 'our' declarations
TimToady authored
398 multi prefix:<:16> ( Str $hexstr --> Num )
399 multi prefix:<:8> ( Str $octstr --> Num )
400 multi prefix:<:2> ( Str $binstr --> Num )
401 multi prefix:<:10> ( Str $decstr --> Num )
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
402 etc.
403
404 Interprets string as a number, with a default
405 hexadecimal/octal/binary/decimal radix. Any radix prefix (0b, 0d, 0x, 0o)
ffef865 @flussence Tidy up overly long lines
flussence authored
406 mentioned inside the string will override this operator (this statement is true:
407 10 == :8("0d10")), except 0b and 0d will be interpreted as hex digits by :16
408 (C<hex("0d10") == :16 "0d10">). C<fail>s on failure.
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
409
410 These aren't really functions, syntactically, but adverbial forms that
411 just happen to allow a parenthesize argument. But more typically you'll
412 see
413
6bd89b1 Whacked a lot of the =$+_ defaults.
lwall authored
414 :4<222>
415 :16<deadbeef>
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
416
417 and such.
418
419 Replaces Perl 5 C<hex> and C<oct>.
420
421
81d7a89 [docs/Perl6/Spec]
agentz authored
422 =back
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
423
424
5e3f183 Took a stab at run and runinstead as proposed by Larry. Suggested :bg…
ajs authored
425 =head2 OS
426
427 =over
428
6631cff gethost function / methods added
ajs authored
429 =item gethost
430
6967af1 @TimToady bloodbath to remove bogus 'our' declarations
TimToady authored
431 multi gethost( --> OS::Name )
432 multi gethost( Str $name, OS::Addfamily :$type --> OS::Name )
433 multi method gethost( OS::Addr $addr: --> OS::Name ) is export
434 multi method gethost( URI $uri: --> OS::Name ) is export
6631cff gethost function / methods added
ajs authored
435
436 The C<gethost> function operates on host naming or address information
437 and returns an C<OS::Name>. An C<OS::Name> is, minimally:
438
439 class OS::Name {
440 has Str $.name;
441 has OS::Addr $.addr;
442 has Array of Str @.aliases;
443 has Array of OS::Addr @.addrs;
444 }
445
446 Such names can apply to anything which has a name that maps
447 to an address, however, in this case the name is a hostname
448 and the address is some sort of network identifier (e.g.
449 an IPV4 address when resolving hosts that have IPV4 addresses).
450
451 When stringified, an C<OS::Name> yields its name. When
b876595 [Spec/Functions.pod] fixed minor typos, added missing arguments to .fmt
masak authored
452 stringified, an C<OS::Addr> yields its address in an
6631cff gethost function / methods added
ajs authored
453 appropriate text format (e.g. "10.1.2.3" for an IPV4 address).
454
455 The optional C<type> adverb can be passed when resolving a hostname,
456 and will filter the result to only those addresses that are of
457 the appropriate address family. This feature may be supported by
458 the underlying operating system, or Perl may emulate it.
459
460 Examples:
461
462 say "Connection from {$socket.peer.gethost}";
463 my $address = gethost("foo.example.com").addr;
464 my $hostname = gethost(:addr<"10.1.2.3">);
465
54d7c1f Fleshed out OS section with chroot, getlogin and kill -- kill suggest…
ajs authored
466 =item chroot
5e3f183 Took a stab at run and runinstead as proposed by Larry. Suggested :bg…
ajs authored
467
6967af1 @TimToady bloodbath to remove bogus 'our' declarations
TimToady authored
468 multi chroot ( Str $path = CALLER::<$_> --> Bool )
5e3f183 Took a stab at run and runinstead as proposed by Larry. Suggested :bg…
ajs authored
469
dff2364 [Spec] slaughter various confusing overloadings of the term 'context'
lwall authored
470 On POSIX systems, changes the process context of the current process such
54d7c1f Fleshed out OS section with chroot, getlogin and kill -- kill suggest…
ajs authored
471 that the "root" directory becomes C<$path> and all rooted paths
472 (those that begin with a leading path separator) are relative to
473 that path. For security reasons, many operating systems limit
474 this functionality to the superuser. The return value will be
475 true on success.
476
477 =item getlogin
478
6967af1 @TimToady bloodbath to remove bogus 'our' declarations
TimToady authored
479 multi getlogin ( --> Str )
54d7c1f Fleshed out OS section with chroot, getlogin and kill -- kill suggest…
ajs authored
480
481 Returns the username of the account running the program. This may
482 not be as secure as using C<getpwuid> on some platforms.
483
484 =item kill
485
6967af1 @TimToady bloodbath to remove bogus 'our' declarations
TimToady authored
486 multi kill ( OS::Signal $signal, Bool :$group, *@pids --> Bool )
487 multi method kill ( Proc::PID $pid: OS::Signal $signal?, Bool :$group --> Bool )
54d7c1f Fleshed out OS section with chroot, getlogin and kill -- kill suggest…
ajs authored
488
489 Sends the given C<$signal> to the process(es) given and returns a boolean
490 value indicating success (true) if all of the processes existed and were
491 sent the signal and failure (false) if any of the processes did not exist
492 or the signal could not be delivered to them.
493
494 The C<$signal> can be initialized from an integer signal number or a
495 string. Common signals are:
496
497 KILL - stop the process, do not allow it to exit gracefully
498 TERM - stop the process, allow it to exit gracefully
499 HUP - Hangup, often used as a request to re-run from scratch
500 STOP - Pause execution
501 CONT - Continue after a STOP
502
503 Consult your operating system documentation for the full list
504 of signal names and numbers. For compatibility, a signal name
505 may be prefixed with "SIG".
506
3ece885 Concurrency.pod suggests a zero-argument method variant of kill. Docu…
ajs authored
507 The method form may omit the signal. In this case, the default signal is
508 C<'TERM'>.
509
54d7c1f Fleshed out OS section with chroot, getlogin and kill -- kill suggest…
ajs authored
510 If the C<:group> named parameter is passed, C<kill> will attempt to
511 send the signal to a process I<group> rather than a single process.
512 This functionality is platform-specific.
513
514 The special signal C<0> can be sent which does not actually deliver a
a40e8a1 Spellcheck pass on Functions
ajs authored
515 signal at all, and is used to determine if processes are still running:
54d7c1f Fleshed out OS section with chroot, getlogin and kill -- kill suggest…
ajs authored
516
517 say "Still running" if $proc.kill(0);
518
5e3f183 Took a stab at run and runinstead as proposed by Larry. Suggested :bg…
ajs authored
519 =item run
93dd4af @donaldh Insert line to fix 'run =item shell' on http://perlcabal.org/syn/S29.…
donaldh authored
520
53821ac @moritz [S29] reworked external command execution
moritz authored
521 =item shell
5e3f183 Took a stab at run and runinstead as proposed by Larry. Suggested :bg…
ajs authored
522
523
aa5522b @jnthn Update run/shell design to match reality.
jnthn authored
524 multi shell ( $expression, :$cwd = $CWD, :%env = %*ENV --> Proc )
525 multi run ( *$cmd, *@args, :$cwd = $CWD, :%env = %*ENV --> Proc )
5e3f183 Took a stab at run and runinstead as proposed by Larry. Suggested :bg…
ajs authored
526
53821ac @moritz [S29] reworked external command execution
moritz authored
527 C<shell> and C<run> execute an external program, and return control to
528 the caller once the program has exited.
5e3f183 Took a stab at run and runinstead as proposed by Larry. Suggested :bg…
ajs authored
529
53821ac @moritz [S29] reworked external command execution
moritz authored
530 C<shell> goes through the system shell (C<cmd> on windows, C</bin/sh>
45ca8c8 @patch fix typos
patch authored
531 on Unixish systems), thus interpreting all the usual shell meta characters.
5e3f183 Took a stab at run and runinstead as proposed by Larry. Suggested :bg…
ajs authored
532
53821ac @moritz [S29] reworked external command execution
moritz authored
533 C<run> treats the first argument as an executable name, and the rest of the
534 positional arguments as command line arguments that are passed to the
45ca8c8 @patch fix typos
patch authored
535 executable without any processing (except that it encodes Strings to buffers
53821ac @moritz [S29] reworked external command execution
moritz authored
536 first, as does C<shell>).
5e3f183 Took a stab at run and runinstead as proposed by Larry. Suggested :bg…
ajs authored
537
aa5522b @jnthn Update run/shell design to match reality.
jnthn authored
538 Both return a C<Proc> object, which boolifies to C<True> if the program had
539 a successful exit and C<False> otherwise. The C<status> method on a C<Proc>
3b936eb @jnthn Mention sink behavior of Proc.
jnthn authored
540 provides the exit code. If a C<False> C<Proc> is sunk, an exception will be
05f46f7 @japhb Fix repeated 'will be thrown'
japhb authored
541 thrown of type C<X::Proc::Unsuccessful>.
5e3f183 Took a stab at run and runinstead as proposed by Larry. Suggested :bg…
ajs authored
542
81994a0 @lizmat Remove :bg parameter from shell()/run()
lizmat authored
543 If you want to execute an external program asynchronously (as in, not waiting
544 for it to be finished), you will need C<Proc::Async>, as specced in
545 L<S17-concurrency>.
5e3f183 Took a stab at run and runinstead as proposed by Larry. Suggested :bg…
ajs authored
546
54d7c1f Fleshed out OS section with chroot, getlogin and kill -- kill suggest…
ajs authored
547 =item runinstead
548
9b4ea89 Carry over @ vs @@ contextualization to zip and Z and map.
lwall authored
549 multi runinstead ( ; Str $path, *@args )
550 multi runinstead ( ; Str $command )
54d7c1f Fleshed out OS section with chroot, getlogin and kill -- kill suggest…
ajs authored
551
552 Identical to C<run> except that it never returns. The executed program
553 replaces the currently running program in memory.
554
fa6452a Moved "syscall" from S16 to S29, as per discussion on mailing list.
wayland authored
555 =item syscall
556
5e3f183 Took a stab at run and runinstead as proposed by Larry. Suggested :bg…
ajs authored
557 =back
558
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
559 =head2 Concurrency
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
560
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
561 There are higher-level models of concurrency management in Perl (see
81d7a89 [docs/Perl6/Spec]
agentz authored
562 L<S17/Concurrency>). These functions are simply the lowest level
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
563 tools
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
564
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
565 =over
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
566
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
567 =item fork
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
568
6967af1 @TimToady bloodbath to remove bogus 'our' declarations
TimToady authored
569 sub Processes::fork( --> Proc )
212b018 Various builtin clarifications such as s/undef/undefine/.
lwall authored
570
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
571 Creates a copy of the current process. Both processes return from
572 C<fork>. The original process returns
9b4ea89 Carry over @ vs @@ contextualization to zip and Z and map.
lwall authored
573 the I<child> process as a C<Proc> object. The newly created process
574 returns the I<parent> process as a C<Proc> object. As with
575 any Proc object, the child process object numifies to the
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
576 process ID (OS dependent integer). However, the parent process object
577 numifies to C<0> so that the child and parent can distinguish each other.
212b018 Various builtin clarifications such as s/undef/undefine/.
lwall authored
578
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
579 Typical usage would be:
212b018 Various builtin clarifications such as s/undef/undefine/.
lwall authored
580
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
581 if !defined(my $pid = fork) {
582 die "Error calling fork: $!";
583 } elsif $pid == 0 {
584 say "I am the new child!";
585 exit 0;
586 } else {
587 say "I am the parent of {+$pid}";
588 wait();
589 }
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
590
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
591 =item wait
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
592
6967af1 @TimToady bloodbath to remove bogus 'our' declarations
TimToady authored
593 multi method wait( Proc $process: *%options --> Proc::Status )
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
594
6967af1 @TimToady bloodbath to remove bogus 'our' declarations
TimToady authored
595 multi wait ( Proc $process = -1, *%options --> Proc::Status )
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
596
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
597 Waits for a child process to terminate and returns the status
a2091db Make it clear that wait needs a numifyable return value
ajs authored
598 object for the child. This status object will numify to the process
599 ID of the child that exited.
600
9b4ea89 Carry over @ vs @@ contextualization to zip and Z and map.
lwall authored
601 Important Proc::Status methods:
212b018 Various builtin clarifications such as s/undef/undefine/.
lwall authored
602
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
603 .exit - Numeric exit value
604 .pid - Process ID
605 .signal - Signal number if any, otherwise 0
212b018 Various builtin clarifications such as s/undef/undefine/.
lwall authored
606
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
607 For historical reasons there is a C<.status> method which is equal to:
212b018 Various builtin clarifications such as s/undef/undefine/.
lwall authored
608
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
609 ($status.exit +< 8) +| $status.signal
212b018 Various builtin clarifications such as s/undef/undefine/.
lwall authored
610
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
611 If C<$process> is supplied, then wait will only return when the given process
9b4ea89 Carry over @ vs @@ contextualization to zip and Z and map.
lwall authored
612 has exited. Either a full C<Proc> object can be passed, or just a
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
613 numeric process ID. A C<-1> explicitly indicates that wait should return
614 immediately if any child process exits.
615
9b4ea89 Carry over @ vs @@ contextualization to zip and Z and map.
lwall authored
616 When called in this way, the returned C<Proc::Status> object
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
617 will have a C<.pid> of C<-1> (which is also what it numifies to) if
618 there was no such process to wait for.
619
620 The named options include:
621
622 =over
623
624 =item blocking
625
626 Defaults to true. If set to false, this forces wait to return immediately.
627
628 =item WNOHANG
629
630 Exists for historical compatibility. C<WNOHANG => 1> is identical to
631 C<blocking => False>.
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
632
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
633 =back
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
634
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
635 =back
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
636
d27427e S16: Added a few attributes to trees
wayland authored
637 =head2 Pending Apocalypse
638
639 The following functions are classified by Apocalypse/Synopsis numbers.
640
641 =over 4
642
643 =item A/S??: OS Interaction
644
645 chroot crypt getlogin /[get|set][pw|gr].*/ kill setpgrp setpriority
646 times
647
648 ... These are probably going to be part of POSIX, automatically imported to GLOBAL B<if> the platform is the right one
649
650 =back
651
652 =head2 Default Functions
653
654 These functions are exported into the default namespace
655
855c007 [S29] fix Pod errors
hinrik authored
656 =over
657
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
658 =item all -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
659
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
660 =item any -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
661
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
662 =item cat -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
663
ce07358 @lizmat Some cleanup/additions to S29
lizmat authored
664 =item categorize -- see S32-setting-library/Containers.pod
665
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
666 =item classify -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
667
30974c6 @masak [S29] updated references to S32 synopsis
masak authored
668 =item defined -- see S32-setting-library/Basics.pod
d27427e S16: Added a few attributes to trees
wayland authored
669
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
670 =item grep -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
671
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
672 =item first -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
673
ce07358 @lizmat Some cleanup/additions to S29
lizmat authored
674 =item join -- see S32-setting-library/Containers.pod
675
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
676 =item keys -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
677
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
678 =item kv -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
679
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
680 =item map -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
681
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
682 =item max -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
683
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
684 =item min -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
685
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
686 =item none -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
687
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
688 =item one -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
689
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
690 =item pairs -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
691
ce07358 @lizmat Some cleanup/additions to S29
lizmat authored
692 =item pick -- see S32-setting-library/Containers.pod
693
d27427e S16: Added a few attributes to trees
wayland authored
694 =item print -- see S32-setting-library/IO.pod
695
696 =item printf -- see S32-setting-library/IO.pod
697
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
698 =item reduce -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
699
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
700 =item reverse -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
701
ce07358 @lizmat Some cleanup/additions to S29
lizmat authored
702 =item roundrobin -- see S32-setting-library/Containers.pod
703
d27427e S16: Added a few attributes to trees
wayland authored
704 =item say -- see S32-setting-library/IO.pod
705
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
706 =item shape -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
707
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
708 =item sort -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
709
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
710 =item srand -- see S32-setting-library/Numeric.pod
d27427e S16: Added a few attributes to trees
wayland authored
711
30974c6 @masak [S29] updated references to S32 synopsis
masak authored
712 =item undefine -- see S32-setting-library/Basics.pod
d27427e S16: Added a few attributes to trees
wayland authored
713
714 =item uri -- see S32-setting-library/IO.pod
715
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
716 =item values -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
717
718 =item warn -- see S32-setting-library/Any.pod
719
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
720 =item zip -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
721
855c007 [S29] fix Pod errors
hinrik authored
722 =back
723
d27427e S16: Added a few attributes to trees
wayland authored
724 =head2 Non-default Functions
725
8fb3cd9 @patch various minor casing/spacing/grammar/syntax fixes
patch authored
726 These functions which existed in Perl 5 still exist but are not part of the default
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
727 namespace any more.
d27427e S16: Added a few attributes to trees
wayland authored
728
729 =head3 Container
730
731 The following functions can now be found in or replaced by something in the Container
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
732 modules.
d27427e S16: Added a few attributes to trees
wayland authored
733
734 delete, exists, pop, push, shift, splice, unshift
735
736 =head3 Numeric
737
5097a7b @Mouq Fix links of the form L<Sdd-x>
Mouq authored
738 See L<S32/Numeric>.
d27427e S16: Added a few attributes to trees
wayland authored
739
740 =head3 IO
741
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
742 The following functions can now be found in or replaced by something in the IO
743 modules.
d27427e S16: Added a few attributes to trees
wayland authored
744
745 accept, bind, binmode, chdir, chmod, chown, close, closedir, connect
746 eof, fcntl, fileno, flock, getc, getsockname, getsockopt, glob, ioctl, link, listen
747 lstat, mkdir, open, opendir, pipe, print, printf, read, readdir, readline, readlink
748 readpipe, recv, rename, rewinddir, rmdir, say, seek, seekdir, select, send, setsockopt
749 shutdown, socket, socketpair, stat, symlink, sysopen, sysread, sysseek
750 syswrite, tell, telldir, truncate, umask, unlink
751
752 =head3 Temporal
753
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
754 The following functions can now be found in or replaced by something in the Temporal
755 modules.
d27427e S16: Added a few attributes to trees
wayland authored
756
757 gmtime, localtime, time
758
759 =head3 String
760
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
761 The following functions can now be found in or replaced by something in the String
762 module.
d27427e S16: Added a few attributes to trees
wayland authored
763
d251a6b @labster unspec quotemeta, fixes #89
labster authored
764 chop, chomp, index, lc, pack, rindex, split, sprintf, substr, uc,
d27427e S16: Added a few attributes to trees
wayland authored
765 ucfirst, unpack
766
767 =head2 Obsolete Functions
768
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
769 Some of these are obsoleted only as general functions, and are still available by using
770 the right packages. Others are obsoleted in that they're keywords, rather than functions
771 (these are in their own section, below).
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
772
773 =over 4
774
d27427e S16: Added a few attributes to trees
wayland authored
775 =item %
776
777 $num1 % $num2
778
a6df0a3 the '%','mod' are the 'modulo' op; 'modulus' is either what you call …
Darren_Duncan authored
779 Does a floating point modulo operation, i.e. 5.5 % 1 == 0.5 and 5 % 2.5 == 0.
d27427e S16: Added a few attributes to trees
wayland authored
780
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
781 =item dbmopen, dbmclose
782
783 use DB_File;
784
785 =item dump
786
902e7ba [S29] An entry for CORE::dump's *actual* purpose
sorear authored
787 Dumped. Restoring from core dumps is in any event not very useful on modern
788 virtual-memory operating systems. Startup acceleration should be accomplished
789 using a precompiler of some kind (details will be very implementation specific),
45ca8c8 @patch fix typos
patch authored
790 or a pre-forking daemon such as Perl 5's App::Persistent (which will be an
902e7ba [S29] An entry for CORE::dump's *actual* purpose
sorear authored
791 external module when it is ported).
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
792
d27427e S16: Added a few attributes to trees
wayland authored
793 =item each
794
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
795 See .pairs() method, above.
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
796
affd391 Replaced iterators with NameServices role, based on an idea of ruoso+…
wayland authored
797 =item endpwent, endgrent, endservent, endprotoent, endnetent, endhostent
d98390b Created UserIterator and GroupIterator, and grouped some S29 function…
wayland authored
798
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
799 The NameServices role in S16 covers most of these.
d98390b Created UserIterator and GroupIterator, and grouped some S29 function…
wayland authored
800
d27427e S16: Added a few attributes to trees
wayland authored
801 =item format, formline
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
802
803 See Exegesis 7.
804
1bfbfe1 Did some work on users and groups
wayland authored
805 =item getgrgid, getgrnam, getpwnam, getpwuid
806
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
807 The User and Group roles in S16 cover most of these.
1bfbfe1 Did some work on users and groups
wayland authored
808
affd391 Replaced iterators with NameServices role, based on an idea of ruoso+…
wayland authored
809 =item getpwent, getgrent, getservent, getnetent, gethostent
d98390b Created UserIterator and GroupIterator, and grouped some S29 function…
wayland authored
810
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
811 The NameServices role in S16 covers most of these.
d98390b Created UserIterator and GroupIterator, and grouped some S29 function…
wayland authored
812
d27427e S16: Added a few attributes to trees
wayland authored
813 =item length()
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
814
bfb393d @Util Fix typos in S02, S03, S21, S26, S29, S99, and S32/Exception.
Util authored
815 This word is banned in Perl 6. You must specify units. In practice, this probably means
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
816 you want Str.chars(), although it could be Str.bytes(), or even something else. See
817 S32-setting-library/String for details.
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
818
a1a0394 @moritz remove last traces of lcfirst
moritz authored
819 =item lcfirst
820
821 Retired due to lack of use case
822
d27427e S16: Added a few attributes to trees
wayland authored
823 =item msgctl, msgget, msgrcv, msgsnd
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
824
d27427e S16: Added a few attributes to trees
wayland authored
825 See IPC::SysV
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
826
212b018 Various builtin clarifications such as s/undef/undefine/.
lwall authored
827 =item local
828
829 Replaced by C<temp> which, unlike C<local>, defaults to not changing the value.
830
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
831 =item lock
832
b3fceb8 @lizmat lock() is now Lock.new and its methods
lizmat authored
833 See L<S17/Concurrency>. C<lock> has been replaced by C<Lock.new> and methods
834 on the C<Lock> object.
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
835
d251a6b @labster unspec quotemeta, fixes #89
labster authored
836 =item quotemeta
837
838 Because regex escaping metacharacters can easily be solved by quotes
839 (L<S05/Simplified lexical parsing of patterns>), and variables are not
840 automatically interpolated (L<S05/Variable (non-)interpolation>), C<quotemeta>
841 is no longer needed.
842
843 Shell escaping should be handled by passing arguments to L<run>, or with code
844 that speaks the language of a specific shell.
845
d27427e S16: Added a few attributes to trees
wayland authored
846 =item pos
847
848 There is no C<pos> function in Perl 6 because that would not allow a string
849 to be shared among threads. Generally you want to use C<$/.to> for that now,
850 or keep your own position variable as a lexical.
851
852 =item prototype
853
854 &func.meta.signature;
855 &func.^signature;
856
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
857 =item ref
858
859 There is no ref() any more, since it was almost always used to get
860 the type name in Perl 5. If you really want the type name, you can
3cdfd90 [Spec] redefine WHAT to stringify to typename plus '()'
lwall authored
861 use C<$var.WHAT.perl>. If you really want P5 ref
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
862 semantics, use C<Perl5::p5ref>.
863
864 But if you're just wanting to test against a type, you're likely better off
865 performing an C<isa> or C<does> or C<can>, or just C<$var ~~ TYPE>.
866
867 =item reset
868
869 Was there a I<good> use for this?
870
d27427e S16: Added a few attributes to trees
wayland authored
871 =item semctl, semget, semop
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
872
d27427e S16: Added a few attributes to trees
wayland authored
873 See IPC::SysV;
874
affd391 Replaced iterators with NameServices role, based on an idea of ruoso+…
wayland authored
875 =item setpwent, setgrent, setservent, setprotoent, setnetent, sethostent
d98390b Created UserIterator and GroupIterator, and grouped some S29 function…
wayland authored
876
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
877 The NameServices role in S16 covers most of these.
d98390b Created UserIterator and GroupIterator, and grouped some S29 function…
wayland authored
878
d27427e S16: Added a few attributes to trees
wayland authored
879 =item shmctl, shmget, shmread, shmwrite
880
881 See IPC::SysV;
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
882
212b018 Various builtin clarifications such as s/undef/undefine/.
lwall authored
883 =item study
884
a40e8a1 Spellcheck pass on Functions
ajs authored
885 Algorithm was too Anglo-centric. Could be brought back if generalized somehow.
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
886
d27427e S16: Added a few attributes to trees
wayland authored
887 =item tie, tied
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
888
d27427e S16: Added a few attributes to trees
wayland authored
889 These are replaced by container types. The compiler is free to assume
890 that any lexical variable is never going to change its container type
891 unless some representation is made to that effect in the declaration.
892 Note: P5's tied() is roughly replaced by P6's variable().
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
893
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
894 XXX Examples?
8747d5e %
juerd authored
895
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
896 my $foo is ....? is tie
897 the meta operation on the container type for 'rebless' -
d27427e S16: Added a few attributes to trees
wayland authored
898 macro tie ( $var, $class, *@args ) { CODE { variable($var).meta.rebless( $class, *@args ) } } )
8747d5e %
juerd authored
899
d27427e S16: Added a few attributes to trees
wayland authored
900 endXXX
8747d5e %
juerd authored
901
d27427e S16: Added a few attributes to trees
wayland authored
902 =item untie
8747d5e %
juerd authored
903
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
904 See notes on "tie", above, but basically these are replaced with container classes.
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
905
d27427e S16: Added a few attributes to trees
wayland authored
906 =item vec
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
907
d27427e S16: Added a few attributes to trees
wayland authored
908 Should replace C<vec> with declared buffer/array of C<bit>, C<uint2>,
909 C<uint4>, etc.
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
910
d27427e S16: Added a few attributes to trees
wayland authored
911 =item waitpid
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
912
d27427e S16: Added a few attributes to trees
wayland authored
913 C<wait> can now be called with or without an optional process/pid.
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
914
d27427e S16: Added a few attributes to trees
wayland authored
915 =item write
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
916
d27427e S16: Added a few attributes to trees
wayland authored
917 See Exegesis 7.
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
918
d27427e S16: Added a few attributes to trees
wayland authored
919 =back
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
920
d27427e S16: Added a few attributes to trees
wayland authored
921 =head3 Keywords
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
922
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
923 The following were listed in Perl 5's perlfunc, but should now be considered keywords
924 rather than functions.
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
925
d27427e S16: Added a few attributes to trees
wayland authored
926 last, my, next, no, our, package, return, sub, use
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
927
d27427e S16: Added a few attributes to trees
wayland authored
928 =head1 Default Export Questions
929
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
930 Not sure whether these are exported by default or not. Also, many may no longer exist; if
931 so, they should be entered in the "Obsolete" section.
d27427e S16: Added a few attributes to trees
wayland authored
932
855c007 [S29] fix Pod errors
hinrik authored
933 =over
934
d27427e S16: Added a few attributes to trees
wayland authored
935 =item Signal-related
936
937 alarm
938 kill
939
940 =item OS or library related
941
d98390b Created UserIterator and GroupIterator, and grouped some S29 function…
wayland authored
942 chroot
943 crypt
944 getlogin
945 getpeername -- should this go on Pipe?
946
947 OS objects:
948
949 --Process
950 getpgrp
951 getppid
952 getpriority
953 setpgrp
954 setpriority
955
956 --Service
957 getservbyname
958 getservbyport
959
960 --Protocol
961 getprotobyname
962 getprotobynumber
963
964 --Network
965 getnetbyaddr
966 getnetbyname
967
968 --Host
969 gethostbyaddr
970 gethostbyname
971
d27427e S16: Added a few attributes to trees
wayland authored
972 =item Flow control
6cac900 S29: Fix formatting
wayland authored
973
f8bc519 [S04] rename break/nobreak to succeed/proceed
lwall authored
974 succeed
975 proceed
d27427e S16: Added a few attributes to trees
wayland authored
976 redo
977
978 =item Other
6cac900 S29: Fix formatting
wayland authored
979
d27427e S16: Added a few attributes to trees
wayland authored
980 caller
981 chr
982 die
983 do
0b7df09 @TimToady rename eval to EVAL to indicate specialness
TimToady authored
984 EVAL
d27427e S16: Added a few attributes to trees
wayland authored
985 exec
986 exit
987 fork
988 goto
989 hex
990 import
991 int
992 oct
993 ord
994 require
995 scalar
996 sleep
997 state
998 syscall
999 system
1000 times
1001 utime
1002 wait
1003
855c007 [S29] fix Pod errors
hinrik authored
1004 =back
1005
3d64f1a @lucasbuchala Move AUTHORS sections to end of file
lucasbuchala authored
1006 =head1 AUTHORS
1007
1008 Rod Adams <rod@rodadams.net>
1009 Larry Wall <larry@wall.org>
1010 Aaron Sherman <ajs@ajs.com>
1011 Mark Stosberg <mark@summersault.com>
1012 Carl Mäsak <cmasak@gmail.com>
1013 Moritz Lenz <moritz@faui2k3.org>
1014 Tim Nelson <wayland@wayland.id.au>
1015 Carlin Bingham <carlin@theintersect.org>
1016 Elizabeth Mattijsen <liz@dijkmat.nl>
d251a6b @labster unspec quotemeta, fixes #89
labster authored
1017 Brent Laabs <bslaabs@gmail.com>
3d64f1a @lucasbuchala Move AUTHORS sections to end of file
lucasbuchala authored
1018
3d430cb [S29] restrict Matcher from taking Bool
lwall authored
1019 =for vim:set expandtab sw=4:
Something went wrong with that request. Please try again.