Skip to content

HTTPS clone URL

Subversion checkout URL

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