Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 1011 lines (660 sloc) 29.169 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
b578b58 @TimToady Distinguish listy ords/chrs from ord/chr
TimToady authored
22 Last Modified: 10 Dec 2010
23 Version: 48
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
9b4ea89 Carry over @ vs @@ contextualization to zip and Z and map.
lwall authored
229 Returns whatever C<$code> returns, or fails.
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
230
231 =item evalfile
232
9b4ea89 Carry over @ vs @@ contextualization to zip and Z and map.
lwall authored
233 multi evalfile (Str $filename ; Grammar :$lang = Perl6)
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
234
235 Behaves like, and replaces Perl 5 C<do EXPR>, with optional C<$lang>
236 support.
237
238
81d7a89 [docs/Perl6/Spec]
agentz authored
239 =item exit
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
240
9b4ea89 Carry over @ vs @@ contextualization to zip and Z and map.
lwall authored
241 multi exit (Int $status = 0)
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
242
243 Stops all program execution, and returns C<$status> to the calling environment.
244
245
246 =item sleep
247
9b4ea89 Carry over @ vs @@ contextualization to zip and Z and map.
lwall authored
248 our Num multi sleep ( Num $for = Inf )
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
249
250 Attempt to sleep for up to C<$for> seconds. Implementations are obligated
a40e8a1 Spellcheck pass on Functions
ajs authored
251 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
252
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
253 See C<Synopsis 17: Concurrency> for more details.
254
255 =item die
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
256
b3ec3ab [Spec/S29-functions.pod] Added some details about die and fail
carlin authored
257 multi die (@LIST)
258
3767644 [Spec/S29-functions.pod] Fixed mistake with 'die'. carlin--, masak++
carlin authored
259 Throws a fatal Exception. The default exception handler prints each element of
260 the list to $*ERR (STDERR).
b3ec3ab [Spec/S29-functions.pod] Added some details about die and fail
carlin authored
261
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
262 =item fail
263
b3ec3ab [Spec/S29-functions.pod] Added some details about die and fail
carlin authored
264 multi fail (Str $message)
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
265
b3ec3ab [Spec/S29-functions.pod] Added some details about die and fail
carlin authored
266 Can only be called inside a routine and causes the routine to C<return> an
267 unthrown exception; a C<Failure> object which stringifies to C<$message>.
268 If C<use fatal> is in effect where the routine was called from, it throws
269 the exception.
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
270
271 =back
272
273
274 =head2 Conversions
275
276 =over
277
81d7a89 [docs/Perl6/Spec]
agentz authored
278 =item bless
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
279
b4c6aab [S29-functions] chasing spec changes to C<bless>
masak authored
280 our Object method bless(Object::RepCandidate $candidate, *@protos, *%init_args)
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
281
b4c6aab [S29-functions] chasing spec changes to C<bless>
masak authored
282 Calling C<bless> on any invocant (but typically a type object) to create a new
283 object with the same class as the invocant.
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
284
b4c6aab [S29-functions] chasing spec changes to C<bless>
masak authored
285 C<$candidate> is used to provide the underlying representation of the object.
286 The default is C<P6opaque>, but various other representations might be
287 desired, especially when interoperating with other languages. C<@protos> and
288 C<%init_args> both provide ways for values to be provided to the new
289 object, just like in the default C<new> method.
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
290
b4c6aab [S29-functions] chasing spec changes to C<bless>
masak authored
291 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
292 C<BUILDALL> routine for the current class, which initializes the object in
81d7a89 [docs/Perl6/Spec]
agentz authored
293 least-derived to most-derived order. See L<S12/Objects>
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
294 for more detailed information on object creation.
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
295
b578b58 @TimToady Distinguish listy ords/chrs from ord/chr
TimToady authored
296 =item chrs
297
298 =item ords
299
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
300 =item chr
301
302 =item ord
303
b578b58 @TimToady Distinguish listy ords/chrs from ord/chr
TimToady authored
304 multi sub chrs( Int *@grid --> List of Char )
305 multi method ords( Str $string: --> List of Int ) is export
15242ee [S29-functions] fix some misplaced types
lwall authored
306 multi method chr( Int $grid: --> Char ) is export
307 multi method ord( Str $string: --> Int ) is export
ccfe539 [Functions] did away with the Uni type
lwall authored
308
b578b58 @TimToady Distinguish listy ords/chrs from ord/chr
TimToady authored
309 C<chrs> takes zero or more integer grapheme ids and returns the
ccfe539 [Functions] did away with the Uni type
lwall authored
310 corresponding characters as a string. If any grapheme id is used
311 that represents a higher abstraction level than the current
312 lexical scope supports, that grapheme is converted to the
313 corresponding lower-level string of codepoints/bytes that would
dff2364 [Spec] slaughter various confusing overloadings of the term 'context'
lwall authored
314 be appropriate to the current pragmatic context, just as any other Str
ccfe539 [Functions] did away with the Uni type
lwall authored
315 would be downgraded in context.
316
b578b58 @TimToady Distinguish listy ords/chrs from ord/chr
TimToady authored
317 C<ords> goes the other direction; it takes a string value and returns
318 character values as integers. The definition of character is pragma dependent.
ccfe539 [Functions] did away with the Uni type
lwall authored
319 Normally it's a grapheme id, but under codepoints or bytes scopes,
320 the string is coerced to the appropriate low-level view and interpreted
321 as codepoints or bytes. Hence, under "use bytes" you will never see a
322 value larger than 256, and under "use codepoints" you will never see a
323 value larger than 0x10ffff. The only guarantee under "use graphemes"
324 (the default) is that the number returned will correspond to the
325 codepoint of the precomposed codepoint representing the grapheme, if
326 there is such a codepoint. Otherwise, the implementation is free to
327 return any unique id that larger than 0x10ffff. (The C<chr> function
328 will know how to backtranslate such ids properly to codepoints or
dff2364 [Spec] slaughter various confusing overloadings of the term 'context'
lwall authored
329 bytes in any context. Note that we are assuming that every codepoint's
330 context knows its normalization preferences, and every byte's context
ccfe539 [Functions] did away with the Uni type
lwall authored
331 also knows its encoding preferences. (These are knowable in the
332 lexical scope via the $?NF and $?ENC compile-time constants).)
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
333
b578b58 @TimToady Distinguish listy ords/chrs from ord/chr
TimToady authored
334 The C<chr> and C<ord> variants are restricted to processing a single
335 character. As is customary, you may pass a longer string to C<ord>,
336 but only the first character will be translated.
337
1b62953 [S29] added slice and hash contextualizers, reordered item and list
masak authored
338 =item item
339
340 our Item multi item ( $item )
341
342 Forces generic Item context on its argument, and returns it.
343
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
344 =item list
345
912d5a4 [S29] more @@ and iterator patchups
lwall authored
346 our List multi list ( Iterable $item ) { $item.iterator.list }
347 our List multi list ( List \$iter ) { $iter }
348
349 Almost a no-op; just makes sure that $item can be iterated.
350
351 =item flat
352
353 our List multi flat ( *@list )
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
354
22c73b2 [S29] syntaxos (grammaros?) (spellos?) (typos?)
diakopter authored
355 Forces flat context on its arguments, and returns them.
912d5a4 [S29] more @@ and iterator patchups
lwall authored
356 The heavy work is done by the C<*@> binding.
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
357
60864d9 @TimToady fossil slice contextualizer -> lol
TimToady authored
358 =item lol
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
359
60864d9 @TimToady fossil slice contextualizer -> lol
TimToady authored
360 our List multi lol ( **@list )
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
361
60864d9 @TimToady fossil slice contextualizer -> lol
TimToady authored
362 Forces the argument list to be evaluated in lol ("list of lists") context.
363 (Subscripts treat such a list of lists as a multidimensional slice.)
364 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
365 The work is actually done by the binding to the C<**@> parameter.
60864d9 @TimToady fossil slice contextualizer -> lol
TimToady authored
366 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
367
1b62953 [S29] added slice and hash contextualizers, reordered item and list
masak authored
368 =item hash
369
370 The C<hash> contextualizer
371
372 our Hash multi hash ( *@list )
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
373
1b62953 [S29] added slice and hash contextualizers, reordered item and list
masak authored
374 Forces the argument list to be evaluated in hash context.
375 The expression is evaluated in list context (flattening any C<Capture>s),
376 then a hash will be created from the list, taken as a list of C<Pair>s.
377 (Any element in the list that is not a C<Pair> will pretend to be a key
378 and grab the next value in the list as its value.) Equivalent to
379 C<%()> (except that empty C<%()> means C<%($/)>, while
380 empty C<hash()> means an empty hash).
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
381
382 =item :16, :8, :2, :10
81d7a89 [docs/Perl6/Spec]
agentz authored
383
6bd89b1 Whacked a lot of the =$+_ defaults.
lwall authored
384 our Num multi prefix:<:16> ( Str $hexstr )
385 our Num multi prefix:<:8> ( Str $octstr )
386 our Num multi prefix:<:2> ( Str $binstr )
387 our Num multi prefix:<:10> ( Str $decstr )
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
388 etc.
389
390 Interprets string as a number, with a default
391 hexadecimal/octal/binary/decimal radix. Any radix prefix (0b, 0d, 0x, 0o)
6bd89b1 Whacked a lot of the =$+_ defaults.
lwall authored
392 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
393 as hex digits by :16 (C<hex("0d10") == :16 "0d10">). C<fail>s on failure.
394
395 These aren't really functions, syntactically, but adverbial forms that
396 just happen to allow a parenthesize argument. But more typically you'll
397 see
398
6bd89b1 Whacked a lot of the =$+_ defaults.
lwall authored
399 :4<222>
400 :16<deadbeef>
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
401
402 and such.
403
404 Replaces Perl 5 C<hex> and C<oct>.
405
406
81d7a89 [docs/Perl6/Spec]
agentz authored
407 =back
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
408
409
5e3f183 Took a stab at run and runinstead as proposed by Larry. Suggested :bg…
ajs authored
410 =head2 OS
411
412 =over
413
6631cff gethost function / methods added
ajs authored
414 =item gethost
415
9b4ea89 Carry over @ vs @@ contextualization to zip and Z and map.
lwall authored
416 our OS::Name multi gethost()
417 our OS::Name multi gethost( Str $name, OS::Addfamily :$type )
6631cff gethost function / methods added
ajs authored
418 our OS::Name multi method gethost( OS::Addr $addr: ) is export
419 our OS::Name multi method gethost( URI $uri: ) is export
420
421 The C<gethost> function operates on host naming or address information
422 and returns an C<OS::Name>. An C<OS::Name> is, minimally:
423
424 class OS::Name {
425 has Str $.name;
426 has OS::Addr $.addr;
427 has Array of Str @.aliases;
428 has Array of OS::Addr @.addrs;
429 }
430
431 Such names can apply to anything which has a name that maps
432 to an address, however, in this case the name is a hostname
433 and the address is some sort of network identifier (e.g.
434 an IPV4 address when resolving hosts that have IPV4 addresses).
435
436 When stringified, an C<OS::Name> yields its name. When
b876595 [Spec/Functions.pod] fixed minor typos, added missing arguments to .fmt
masak authored
437 stringified, an C<OS::Addr> yields its address in an
6631cff gethost function / methods added
ajs authored
438 appropriate text format (e.g. "10.1.2.3" for an IPV4 address).
439
440 The optional C<type> adverb can be passed when resolving a hostname,
441 and will filter the result to only those addresses that are of
442 the appropriate address family. This feature may be supported by
443 the underlying operating system, or Perl may emulate it.
444
445 Examples:
446
447 say "Connection from {$socket.peer.gethost}";
448 my $address = gethost("foo.example.com").addr;
449 my $hostname = gethost(:addr<"10.1.2.3">);
450
54d7c1f Fleshed out OS section with chroot, getlogin and kill -- kill suggest…
ajs authored
451 =item chroot
5e3f183 Took a stab at run and runinstead as proposed by Larry. Suggested :bg…
ajs authored
452
9b4ea89 Carry over @ vs @@ contextualization to zip and Z and map.
lwall authored
453 our Bool multi chroot ( Str $path = CALLER::<$_> )
5e3f183 Took a stab at run and runinstead as proposed by Larry. Suggested :bg…
ajs authored
454
dff2364 [Spec] slaughter various confusing overloadings of the term 'context'
lwall authored
455 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
456 that the "root" directory becomes C<$path> and all rooted paths
457 (those that begin with a leading path separator) are relative to
458 that path. For security reasons, many operating systems limit
459 this functionality to the superuser. The return value will be
460 true on success.
461
462 =item getlogin
463
9b4ea89 Carry over @ vs @@ contextualization to zip and Z and map.
lwall authored
464 our Str multi getlogin ()
54d7c1f Fleshed out OS section with chroot, getlogin and kill -- kill suggest…
ajs authored
465
466 Returns the username of the account running the program. This may
467 not be as secure as using C<getpwuid> on some platforms.
468
469 =item kill
470
9b4ea89 Carry over @ vs @@ contextualization to zip and Z and map.
lwall authored
471 our Bool multi kill ( OS::Signal $signal, Bool :$group, *@pids )
472 our Bool multi method kill ( Proc::PID $pid: OS::Signal $signal?, Bool :$group )
54d7c1f Fleshed out OS section with chroot, getlogin and kill -- kill suggest…
ajs authored
473
474 Sends the given C<$signal> to the process(es) given and returns a boolean
475 value indicating success (true) if all of the processes existed and were
476 sent the signal and failure (false) if any of the processes did not exist
477 or the signal could not be delivered to them.
478
479 The C<$signal> can be initialized from an integer signal number or a
480 string. Common signals are:
481
482 KILL - stop the process, do not allow it to exit gracefully
483 TERM - stop the process, allow it to exit gracefully
484 HUP - Hangup, often used as a request to re-run from scratch
485 STOP - Pause execution
486 CONT - Continue after a STOP
487
488 Consult your operating system documentation for the full list
489 of signal names and numbers. For compatibility, a signal name
490 may be prefixed with "SIG".
491
3ece885 Concurrency.pod suggests a zero-argument method variant of kill. Docu…
ajs authored
492 The method form may omit the signal. In this case, the default signal is
493 C<'TERM'>.
494
54d7c1f Fleshed out OS section with chroot, getlogin and kill -- kill suggest…
ajs authored
495 If the C<:group> named parameter is passed, C<kill> will attempt to
496 send the signal to a process I<group> rather than a single process.
497 This functionality is platform-specific.
498
499 The special signal C<0> can be sent which does not actually deliver a
a40e8a1 Spellcheck pass on Functions
ajs authored
500 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
501
502 say "Still running" if $proc.kill(0);
503
5e3f183 Took a stab at run and runinstead as proposed by Larry. Suggested :bg…
ajs authored
504 =item run
505
27c19bb History as written by the winners:
lwall authored
506 our Proc::Status multi run ( ; Str $command, :%env = %*ENV )
507 our Proc::Status multi run ( ; Str $path, *@args, :%env = %*ENV )
508 our Proc::Status multi run ( Str @path_and_args, :%env = %*ENV )
5e3f183 Took a stab at run and runinstead as proposed by Larry. Suggested :bg…
ajs authored
509
27c19bb History as written by the winners:
lwall authored
510 our Proc multi run ( ; Str $command, Bool :$bg!, :%env = %*ENV )
511 our Proc multi run ( ; Str $path, Bool :$bg!, *@args, :%env = %*ENV )
512 our Proc multi run ( Str @path_and_args, Bool :$bg!, :%env = %*ENV )
5e3f183 Took a stab at run and runinstead as proposed by Larry. Suggested :bg…
ajs authored
513
514 C<run> executes an external program, and returns control to the caller
515 once the program has exited.
516
517 The default form expects a single string argument which contains the
518 full command-line. This command-line will be scanned for special
519 characters that the operating system's shell might interpret such as
520 C<;> or embedded quotes. If any are found, the command will be run
521 through a sub-shell in an operating system specific fashion (on
522 POSIX systems, this means C<sh -c>).
523
524 If called like this:
525
526 run( :path<'/some/path'>, 'arg1', 'arg2', ... )
527
528 or with a single array (containing both the path and arguments), then the
529 path given is executed directly with no shell interpretation.
530
531 The return value is the exit status
532 of the program, and can be evaluated in the following contexts:
533
534 Bool - True = success; False = failure
535 Int - Exit status (per the .exit method)
536
9b4ea89 Carry over @ vs @@ contextualization to zip and Z and map.
lwall authored
537 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
538 is used.
539
540 On failure to execute, an undefined value is returned.
541
542 If the C<:bg> named parameter is passed, the program will be executed
543 in the background, and the run command will return as soon as the
544 child process is created. This means that the object returned is
9b4ea89 Carry over @ vs @@ contextualization to zip and Z and map.
lwall authored
545 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
546
547 [ Note: should the :bg form take rw filehandles or is that over-overloading
548 the functionality of run? Should run be the new open with
549 respect to executing external code? -ajs ]
550
551 [ Note: system() should be renamed to sys() or sh() or run() or
552 some such to avoid P5-induced boolean inversion confusion, plus
a40e8a1 Spellcheck pass on Functions
ajs authored
553 Huffmanize it a little better. I'm thinking run() might be best
5e3f183 Took a stab at run and runinstead as proposed by Larry. Suggested :bg…
ajs authored
554 for MMD reasons. --law
555
556 Note: exec should also be renamed to something clearer and "final"
557 and huffmanly longer. I'm thinking runinstead(). And maybe the
558 function behind qq:x should be rungather() rather than readpipe(). -law
559 ]
560
54d7c1f Fleshed out OS section with chroot, getlogin and kill -- kill suggest…
ajs authored
561 =item runinstead
562
9b4ea89 Carry over @ vs @@ contextualization to zip and Z and map.
lwall authored
563 multi runinstead ( ; Str $path, *@args )
564 multi runinstead ( ; Str $command )
54d7c1f Fleshed out OS section with chroot, getlogin and kill -- kill suggest…
ajs authored
565
566 Identical to C<run> except that it never returns. The executed program
567 replaces the currently running program in memory.
568
fa6452a Moved "syscall" from S16 to S29, as per discussion on mailing list.
wayland authored
569 =item syscall
570
5e3f183 Took a stab at run and runinstead as proposed by Larry. Suggested :bg…
ajs authored
571 =back
572
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
573 =head2 Concurrency
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
574
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
575 There are higher-level models of concurrency management in Perl (see
81d7a89 [docs/Perl6/Spec]
agentz authored
576 L<S17/Concurrency>). These functions are simply the lowest level
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
577 tools
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
578
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
579 =over
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
580
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
581 =item fork
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
582
9b4ea89 Carry over @ vs @@ contextualization to zip and Z and map.
lwall authored
583 our Proc sub Processes::fork()
212b018 Various builtin clarifications such as s/undef/undefine/.
lwall authored
584
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
585 Creates a copy of the current process. Both processes return from
586 C<fork>. The original process returns
9b4ea89 Carry over @ vs @@ contextualization to zip and Z and map.
lwall authored
587 the I<child> process as a C<Proc> object. The newly created process
588 returns the I<parent> process as a C<Proc> object. As with
589 any Proc object, the child process object numifies to the
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
590 process ID (OS dependent integer). However, the parent process object
591 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
592
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
593 Typical usage would be:
212b018 Various builtin clarifications such as s/undef/undefine/.
lwall authored
594
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
595 if !defined(my $pid = fork) {
596 die "Error calling fork: $!";
597 } elsif $pid == 0 {
598 say "I am the new child!";
599 exit 0;
600 } else {
601 say "I am the parent of {+$pid}";
602 wait();
603 }
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
604
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
605 =item wait
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
606
9b4ea89 Carry over @ vs @@ contextualization to zip and Z and map.
lwall authored
607 our Proc::Status multi method wait( Proc $process: *%options )
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
608
9b4ea89 Carry over @ vs @@ contextualization to zip and Z and map.
lwall authored
609 our Proc::Status multi wait ( Proc $process = -1, *%options )
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
610
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
611 Waits for a child process to terminate and returns the status
a2091db Make it clear that wait needs a numifyable return value
ajs authored
612 object for the child. This status object will numify to the process
613 ID of the child that exited.
614
9b4ea89 Carry over @ vs @@ contextualization to zip and Z and map.
lwall authored
615 Important Proc::Status methods:
212b018 Various builtin clarifications such as s/undef/undefine/.
lwall authored
616
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
617 .exit - Numeric exit value
618 .pid - Process ID
619 .signal - Signal number if any, otherwise 0
212b018 Various builtin clarifications such as s/undef/undefine/.
lwall authored
620
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
621 For historical reasons there is a C<.status> method which is equal to:
212b018 Various builtin clarifications such as s/undef/undefine/.
lwall authored
622
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
623 ($status.exit +< 8) +| $status.signal
212b018 Various builtin clarifications such as s/undef/undefine/.
lwall authored
624
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
625 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
626 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
627 numeric process ID. A C<-1> explicitly indicates that wait should return
628 immediately if any child process exits.
629
9b4ea89 Carry over @ vs @@ contextualization to zip and Z and map.
lwall authored
630 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
631 will have a C<.pid> of C<-1> (which is also what it numifies to) if
632 there was no such process to wait for.
633
634 The named options include:
635
636 =over
637
638 =item blocking
639
640 Defaults to true. If set to false, this forces wait to return immediately.
641
642 =item WNOHANG
643
644 Exists for historical compatibility. C<WNOHANG => 1> is identical to
645 C<blocking => False>.
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
646
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
647 =back
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
648
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
649 =back
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
650
d27427e S16: Added a few attributes to trees
wayland authored
651 =head2 Pending Apocalypse
652
653 The following functions are classified by Apocalypse/Synopsis numbers.
654
655 =over 4
656
657 =item A/S??: OS Interaction
658
659 chroot crypt getlogin /[get|set][pw|gr].*/ kill setpgrp setpriority
660 times
661
662 ... These are probably going to be part of POSIX, automatically imported to GLOBAL B<if> the platform is the right one
663
664 =back
665
666 =head2 Default Functions
667
668 These functions are exported into the default namespace
669
855c007 [S29] fix Pod errors
hinrik authored
670 =over
671
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
672 =item all -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
673
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
674 =item any -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
675
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
676 =item cat -- 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 classify -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
679
680 =item defined -- see S32-setting-library/Scalars.pod
681
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
682 =item grep -- 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 first -- 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 keys -- 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 kv -- 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 join -- 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 map -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
693
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
694 =item max -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
695
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
696 =item min -- 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 none -- 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 one -- 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 pairs -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
703
704 =item print -- see S32-setting-library/IO.pod
705
706 =item printf -- see S32-setting-library/IO.pod
707
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
708 =item roundrobin -- 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 pick -- 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 reduce -- 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 reverse -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
715
716 =item say -- see S32-setting-library/IO.pod
717
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
718 =item shape -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
719
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
720 =item sort -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
721
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
722 =item srand -- see S32-setting-library/Numeric.pod
d27427e S16: Added a few attributes to trees
wayland authored
723
5286e00 minor typo
duff authored
724 =item undefine -- see S32-setting-library/Scalars.pod
d27427e S16: Added a few attributes to trees
wayland authored
725
726 =item uri -- see S32-setting-library/IO.pod
727
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
728 =item values -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
729
730 =item warn -- see S32-setting-library/Any.pod
731
328c62a S29: s/Container.pod/Containers.pod/
wayland authored
732 =item zip -- see S32-setting-library/Containers.pod
d27427e S16: Added a few attributes to trees
wayland authored
733
855c007 [S29] fix Pod errors
hinrik authored
734 =back
735
d27427e S16: Added a few attributes to trees
wayland authored
736 =head2 Non-default Functions
737
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
738 These functions which existed in perl5 still exist, but are not part of the default
739 namespace any more.
d27427e S16: Added a few attributes to trees
wayland authored
740
741 =head3 Container
742
743 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
744 modules.
d27427e S16: Added a few attributes to trees
wayland authored
745
746 delete, exists, pop, push, shift, splice, unshift
747
748 =head3 Numeric
749
e47ba08 [S29] remove fossile noted by tylercurtis++
moritz authored
750 See L<S32-setting-library/Numeric>.
d27427e S16: Added a few attributes to trees
wayland authored
751
752 =head3 IO
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 IO
755 modules.
d27427e S16: Added a few attributes to trees
wayland authored
756
757 accept, bind, binmode, chdir, chmod, chown, close, closedir, connect
758 eof, fcntl, fileno, flock, getc, getsockname, getsockopt, glob, ioctl, link, listen
759 lstat, mkdir, open, opendir, pipe, print, printf, read, readdir, readline, readlink
760 readpipe, recv, rename, rewinddir, rmdir, say, seek, seekdir, select, send, setsockopt
761 shutdown, socket, socketpair, stat, symlink, sysopen, sysread, sysseek
762 syswrite, tell, telldir, truncate, umask, unlink
763
764 =head3 Temporal
765
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
766 The following functions can now be found in or replaced by something in the Temporal
767 modules.
d27427e S16: Added a few attributes to trees
wayland authored
768
769 gmtime, localtime, time
770
771 =head3 String
772
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
773 The following functions can now be found in or replaced by something in the String
774 module.
d27427e S16: Added a few attributes to trees
wayland authored
775
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
776 chop, chomp, index, lc, lcfirst, pack, quotemeta, rindex, split, sprintf, substr, uc,
d27427e S16: Added a few attributes to trees
wayland authored
777 ucfirst, unpack
778
779 =head2 Obsolete Functions
780
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
781 Some of these are obsoleted only as general functions, and are still available by using
782 the right packages. Others are obsoleted in that they're keywords, rather than functions
783 (these are in their own section, below).
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
784
785 =over 4
786
d27427e S16: Added a few attributes to trees
wayland authored
787 =item %
788
789 $num1 % $num2
790
a6df0a3 the '%','mod' are the 'modulo' op; 'modulus' is either what you call …
Darren_Duncan authored
791 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
792
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
793 =item dbmopen, dbmclose
794
795 use DB_File;
796
797 =item dump
798
902e7ba [S29] An entry for CORE::dump's *actual* purpose
sorear authored
799 Dumped. Restoring from core dumps is in any event not very useful on modern
800 virtual-memory operating systems. Startup acceleration should be accomplished
801 using a precompiler of some kind (details will be very implementation specific),
802 or a pre-forking daemon such as Perl 5's App::Persistant (which will be an
803 external module when it is ported).
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
804
d27427e S16: Added a few attributes to trees
wayland authored
805 =item each
806
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
807 See .pairs() method, above.
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
808
affd391 Replaced iterators with NameServices role, based on an idea of ruoso+…
wayland authored
809 =item endpwent, endgrent, endservent, endprotoent, endnetent, endhostent
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 format, formline
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
814
815 See Exegesis 7.
816
1bfbfe1 Did some work on users and groups
wayland authored
817 =item getgrgid, getgrnam, getpwnam, getpwuid
818
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
819 The User and Group roles in S16 cover most of these.
1bfbfe1 Did some work on users and groups
wayland authored
820
affd391 Replaced iterators with NameServices role, based on an idea of ruoso+…
wayland authored
821 =item getpwent, getgrent, getservent, getnetent, gethostent
d98390b Created UserIterator and GroupIterator, and grouped some S29 function…
wayland authored
822
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
823 The NameServices role in S16 covers most of these.
d98390b Created UserIterator and GroupIterator, and grouped some S29 function…
wayland authored
824
d27427e S16: Added a few attributes to trees
wayland authored
825 =item length()
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
826
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
827 This word is banned in Perl 6. You must specify units. In practise, this probably means
828 you want Str.chars(), although it could be Str.bytes(), or even something else. See
829 S32-setting-library/String for details.
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
830
d27427e S16: Added a few attributes to trees
wayland authored
831 =item msgctl, msgget, msgrcv, msgsnd
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
832
d27427e S16: Added a few attributes to trees
wayland authored
833 See IPC::SysV
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
834
212b018 Various builtin clarifications such as s/undef/undefine/.
lwall authored
835 =item local
836
837 Replaced by C<temp> which, unlike C<local>, defaults to not changing the value.
838
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
839 =item lock
840
81d7a89 [docs/Perl6/Spec]
agentz authored
841 See L<S17/Concurrency>. C<lock> has been replaced by
2395ca6 Updates to S29 / Functions based on p6l disucssions and some general …
ajs authored
842 C<is atomic>.
843
d27427e S16: Added a few attributes to trees
wayland authored
844 =item pos
845
846 There is no C<pos> function in Perl 6 because that would not allow a string
847 to be shared among threads. Generally you want to use C<$/.to> for that now,
848 or keep your own position variable as a lexical.
849
850 =item prototype
851
852 &func.meta.signature;
853 &func.^signature;
854
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
855 =item ref
856
857 There is no ref() any more, since it was almost always used to get
858 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
859 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
860 semantics, use C<Perl5::p5ref>.
861
862 But if you're just wanting to test against a type, you're likely better off
863 performing an C<isa> or C<does> or C<can>, or just C<$var ~~ TYPE>.
864
865 =item reset
866
867 Was there a I<good> use for this?
868
d27427e S16: Added a few attributes to trees
wayland authored
869 =item semctl, semget, semop
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
870
d27427e S16: Added a few attributes to trees
wayland authored
871 See IPC::SysV;
872
affd391 Replaced iterators with NameServices role, based on an idea of ruoso+…
wayland authored
873 =item setpwent, setgrent, setservent, setprotoent, setnetent, sethostent
d98390b Created UserIterator and GroupIterator, and grouped some S29 function…
wayland authored
874
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
875 The NameServices role in S16 covers most of these.
d98390b Created UserIterator and GroupIterator, and grouped some S29 function…
wayland authored
876
d27427e S16: Added a few attributes to trees
wayland authored
877 =item shmctl, shmget, shmread, shmwrite
878
879 See IPC::SysV;
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
880
212b018 Various builtin clarifications such as s/undef/undefine/.
lwall authored
881 =item study
882
a40e8a1 Spellcheck pass on Functions
ajs authored
883 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
884
d27427e S16: Added a few attributes to trees
wayland authored
885 =item tie, tied
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 These are replaced by container types. The compiler is free to assume
888 that any lexical variable is never going to change its container type
889 unless some representation is made to that effect in the declaration.
890 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
891
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
892 XXX Examples?
8747d5e %
juerd authored
893
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
894 my $foo is ....? is tie
895 the meta operation on the container type for 'rebless' -
d27427e S16: Added a few attributes to trees
wayland authored
896 macro tie ( $var, $class, *@args ) { CODE { variable($var).meta.rebless( $class, *@args ) } } )
8747d5e %
juerd authored
897
d27427e S16: Added a few attributes to trees
wayland authored
898 endXXX
8747d5e %
juerd authored
899
d27427e S16: Added a few attributes to trees
wayland authored
900 =item untie
8747d5e %
juerd authored
901
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
902 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
903
d27427e S16: Added a few attributes to trees
wayland authored
904 =item vec
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 Should replace C<vec> with declared buffer/array of C<bit>, C<uint2>,
907 C<uint4>, etc.
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
908
d27427e S16: Added a few attributes to trees
wayland authored
909 =item waitpid
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 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
912
d27427e S16: Added a few attributes to trees
wayland authored
913 =item write
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 See Exegesis 7.
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 =back
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 =head3 Keywords
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
920
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
921 The following were listed in Perl 5's perlfunc, but should now be considered keywords
922 rather than functions.
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
923
d27427e S16: Added a few attributes to trees
wayland authored
924 last, my, next, no, our, package, return, sub, use
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 =head1 Default Export Questions
927
9d5a38d P6 Synopsis : ws changes - remove trailing spaces
Darren_Duncan authored
928 Not sure whether these are exported by default or not. Also, many may no longer exist; if
929 so, they should be entered in the "Obsolete" section.
d27427e S16: Added a few attributes to trees
wayland authored
930
855c007 [S29] fix Pod errors
hinrik authored
931 =over
932
d27427e S16: Added a few attributes to trees
wayland authored
933 =item Signal-related
934
935 alarm
936 kill
937
938 =item OS or library related
939
d98390b Created UserIterator and GroupIterator, and grouped some S29 function…
wayland authored
940 chroot
941 crypt
942 getlogin
943 getpeername -- should this go on Pipe?
944
945 OS objects:
946
947 --Process
948 getpgrp
949 getppid
950 getpriority
951 setpgrp
952 setpriority
953
954 --Service
955 getservbyname
956 getservbyport
957
958 --Protocol
959 getprotobyname
960 getprotobynumber
961
962 --Network
963 getnetbyaddr
964 getnetbyname
965
966 --Host
967 gethostbyaddr
968 gethostbyname
969
d27427e S16: Added a few attributes to trees
wayland authored
970 =item Flow control
6cac900 S29: Fix formatting
wayland authored
971
f8bc519 [S04] rename break/nobreak to succeed/proceed
lwall authored
972 succeed
973 proceed
d27427e S16: Added a few attributes to trees
wayland authored
974 redo
975
976 =item Other
6cac900 S29: Fix formatting
wayland authored
977
b6cc77c Moved Junctions from S29 to Containers.pod
wayland authored
978 bless
d27427e S16: Added a few attributes to trees
wayland authored
979 caller
980 chr
981 die
982 do
983 eval
984 exec
985 exit
986 fork
987 goto
988 hex
989 import
990 int
991 oct
992 ord
993 require
994 scalar
995 sleep
996 state
997 syscall
998 system
999 times
1000 utime
1001 wait
1002
855c007 [S29] fix Pod errors
hinrik authored
1003 =back
1004
a630d8c * repo-copy S26.pod and S29.pod into docs/Perl6/Spec/.
audreyt authored
1005 =head1 Additions
1006
1007 Please post errors and feedback to perl6-language. If you are making
1008 a general laundry list, please separate messages by topic.
192b028 Renamed .words to .comb
lwall authored
1009
3d430cb [S29] restrict Matcher from taking Bool
lwall authored
1010 =for vim:set expandtab sw=4:
Something went wrong with that request. Please try again.