Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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