Skip to content

Commit cd52552

Browse files
committed
Merge branch 'master' of github.com:perl6/doc
2 parents e135e36 + c95dba0 commit cd52552

File tree

8 files changed

+165
-27
lines changed

8 files changed

+165
-27
lines changed

doc/Language/5to6-perlvar.pod

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,8 @@ only difference seems to be that OLDPWD is missing from Perl 6's %ENV.
159159
160160
=item $]
161161
162-
The version of the perl is returned by C<$*PERL.version>. As of this writing,
163-
that is "vunknown", which may be less than useful. For the record, C<$*PERL>
164-
itself contains, as of this writing, "Perl 6".
162+
The version of perl is returned by C<$*PERL.version>. For the beta this was
163+
"v6.b" with C<$*PERL> containing "Perl 6 (6.b)".
165164
166165
=item $SYSTEM_FD_MAX
167166

doc/Language/concurrency.pod

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
55
=SUBTITLE Concurrency and Asynchronous Programming
66
7-
In common with most modern programming languages Perl 6 is designed to
7+
In common with most modern programming languages, Perl 6 is designed to
88
L<support concurrency|http://en.wikipedia.org/wiki/Concurrent_computing>
9-
(allowing more than one thing to happen at the same time,) and
9+
(allowing more than one thing to happen at the same time) and
1010
asynchronous programming (sometime called event driven or reactive
1111
programming - that is an event or change in some part of a program
1212
may lead to an event or change in some other part of the program
13-
asynchronously to the program flow. )
13+
asynchronously to the program flow).
1414
1515
The aim of the Perl concurrency design is to provide a high-level,
16-
composable, consistent interface regardless of how a virtual machine
16+
composable, consistent interface, regardless of how a virtual machine
1717
may implement it for a particular operating system, through layers of
1818
facilities as described below.
1919
@@ -25,8 +25,8 @@ hyper-operators, autothreading junctions?
2525
2626
=end comment
2727
28-
Additionally certain Perl features may implicitly operate in an asynchronous
29-
fashion, so in order to ensure predictable interoperation with these features
28+
Additionally, certain Perl features may implicitly operate in an asynchronous
29+
fashion, so in order to ensure predictable interoperation with these features,
3030
user code should, where possible, avoid the lower level concurrency APIs
3131
(i.e. L<Thread> and L<Scheduler> ) and use the higher-level interfaces.
3232
@@ -82,9 +82,9 @@ is illustrated with:
8282
8383
Here the C<break> will cause the code block of the C<then> to throw an
8484
exception when it calls the C<result> method on the original promise
85-
that was passed as an argument which will subsequently cause the second
85+
that was passed as an argument, which will subsequently cause the second
8686
promise to be broken, raising an exception in turn when its result
87-
is taken. The actual L<Exception> object will then be available from
87+
is taken. The actual L<Exception> object will then be available from
8888
C<cause>. If the promise had not been broken C<cause> would raise a
8989
L<X::Promise::CauseOnlyValidOnBroken> exception.
9090
@@ -109,7 +109,7 @@ for that:
109109
say $promise.result; # 55
110110
111111
Here the C<result> of the promise returned is the value returned from
112-
the code. Similarly if the code fails (and the promise is thus broken,)
112+
the code. Similarly if the code fails (and the promise is thus broken),
113113
then C<cause> will be the L<Exception> object that was thrown:
114114
115115
my $promise = Promise.start({ die "Broken Promise" });
@@ -212,13 +212,13 @@ necessary to do it for these.
212212
213213
A L<Supply> is an asynchronous data streaming mechanism that can be
214214
consumed by one or more consumers simultaneously in a manner similar to
215-
"events" in other programming languages and can be seem as enabling
215+
"events" in other programming languages and can be seen as enabling
216216
"Event Driven" or reactive designs.
217217
218218
L<Supply> is a role that can be composed into your own types, but will
219219
frequently be used as a "type punned" class to create standalone objects.
220220
221-
At its simplest a L<Supply> is a message stream that can have multiple
221+
At its simplest, a L<Supply> is a message stream that can have multiple
222222
subscribers created with the method C<tap> on to which data items can be
223223
placed with C<emit>:
224224

doc/Language/faq.pod

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ Google is often outdated.
4444
You could also try searching the Freenode #perl6 IRC channel log via
4545
L<Google|https://www.google.co.uk/search?q=site:irclog.perlgeek.de+inurl:perl6>
4646
47+
=head2 What is the Perl 6 spec?
48+
49+
The "spec" refers to the official test suite for Perl 6. It's called
50+
roast and L<hosted on github|https://github.com/perl6/roast>. It
51+
is the measure of how complete a Perl 6 implementation is.
52+
4753
=head2 Is there a glossary of Perl 6 related terms?
4854
4955
See L<S99|http://design.perl6.org/S99.html>
@@ -513,7 +519,7 @@ Examples:
513519
514520
class Foo { has $.i is rw};
515521
516-
for (1..10000) -> $i {
522+
for (1..1_000_000) -> $i {
517523
my $obj = Foo.new;
518524
$obj.i = $i;
519525
say $obj.i;
@@ -526,11 +532,16 @@ Examples:
526532
527533
has i => ( is=> 'rw');
528534
529-
for my $i (1..10000) {
535+
for my $i (1..1_000_000) {
530536
my $obj = Foo->new;
531537
$obj->i($i);
532538
say $obj->i;
533539
}
534540
541+
__PACKAGE__->meta->make_immutable;
542+
543+
1;
544+
545+
535546
536547
=end pod

doc/Language/modules.pod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ files in a namespace.
2121
2222
=head2 Basic Structure
2323
24-
Module distributions in Perl 6 have the same stucture as any distribution in
24+
Module distributions in Perl 6 have the same structure as any distribution in
2525
the Perl family of languages: there is a main project directory containing
2626
a C<README> and C<LICENSE> file, a C<lib> directory for modules, a C<t>
2727
directory for tests, and possibly a C<bin> directory for executable programs

doc/Language/nativecall.pod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ how to do the marshalling.
7878
7979
sub message_box(Str is encoded('utf8')) is native('libgui') { * }
8080
81-
To specify how to marshall string return types, just apply this trait to the
81+
To specify how to marshal string return types, just apply this trait to the
8282
routine itself.
8383
8484
sub input_box() returns Str is encoded('utf8') is native('libgui') { * }

doc/Type/Callable.pod

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,20 @@
99
Role for objects which support calling them. It's used in L<Block>,
1010
L<Routine>, L<Sub>, L<Method>, L<Submethod> and L<Macro> types.
1111
12+
=head1 Methods
13+
14+
=head2 method assuming
15+
16+
method assuming (Callable:D $self: |primers)
17+
18+
Returns a C<Callable> that implements the same behaviour as the
19+
original, but has the values passed to .assuming already bound to the
20+
corresponding parameters.
21+
22+
sub add(Int $x,Int $y) { $x + $y };
23+
my &add_to_5 = &add.assuming(5);
24+
say add_to_5(4); #-> 9
25+
26+
=comment according to design docs it's Callable but in rakudo it's assuming is in Block
27+
1228
=end pod

doc/Type/Junction.pod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ produce an empty list:
6767
my @a = ();
6868
so all(@a) # True, because there are 0 False's
6969
70-
To express "all, but at least one", you can use C<@a && all(@a)
70+
To express "all, but at least one", you can use C<@a && all(@a)>
7171
7272
say so @a && all(@a); # False
7373

doc/Type/Supply.pod

Lines changed: 120 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -343,15 +343,127 @@ Creates a "rotoring" supply with the same semantics as List.rotor.
343343
Creates a new supply in which all values flowing through the given supply
344344
are emitted, but with the given delay in seconds.
345345
346-
=head2 throttle
346+
=head2 method throttle
347347
348-
method throttle(Supply:D: $elems, $seconds, $delay = 0, :$scheduler) returns Supply:D
348+
method throttle(Supply:D:
349+
$limit, # values / time or simultaneous processing
350+
$seconds or $callable, # time-unit / code to process simultaneously
351+
$delay = 0, # initial delay before starting, in seconds
352+
:$control, # supply to emit control messages on (optional)
353+
:$status, # supply to tap status messages from (optional)
354+
:$bleed, # supply to bleed messages to (optional)
355+
:$vent-at, # bleed when so many buffered (optional)
356+
:$scheduler, # scheduler to use, default $*SCHEDULER
357+
) returns Supply:D
349358
350-
Produces a C<Supply> that throttles emitting the values of the given Supply
351-
on the created C<Supply> by the number of elements (specified by the first
352-
parameter) per number of seconds (specified by the second parameter).
353-
Optionally allows for specification of delay (in number of seconds), and
354-
scheduler to be used (defaults to $*SCHEDULER).
359+
Produces a C<Supply> from a given Supply, but makes sure the number of
360+
messages passed through, is limited.
361+
362+
It has two modes of operation: per time-unit or by maximum number of
363+
execution of a block of code: this is determined by the second positional
364+
parameter.
365+
366+
The first positional parameter specifies the limit that should be applied.
367+
368+
If the second positional parameter is a C<Callable>, then the limit indicates
369+
the maximum number of parallel processes executing the Callable, which is
370+
given the value that was received. The emitted values in this case will be
371+
the C<Promise>s that were obtained from C<start>ing the Callable.
372+
373+
If the second positional parameter is a numeric value, it is interpreted as
374+
the time-unit (in seconds). If you specify B<.1> as the value, then it makes
375+
sure you don't exceed the limit for every tenth of a second.
376+
377+
If the limit is exceeded, then incoming messages are buffered until there
378+
is room to pass on / execute the Callable again.
379+
380+
The third positional parameter is optional: it indicates the number of
381+
seconds the throttle will wait before passing on any values.
382+
383+
The :control named parameter optionally specifies a Supply that you can
384+
use to control the throttle while it is in operation. Messages that
385+
can be sent, are strings in the form of "key:value". Please see below
386+
for the types of messages that you can send to control the throttle.
387+
388+
The :status named parameter optionally specifies a Supply that will receive
389+
any status messages. If specified, it will at least send one status message
390+
after the original Supply is exhausted. The status message is a hash with
391+
the following keys:
392+
393+
=over 2
394+
395+
=item allowed
396+
397+
The current number of messages / callables that is still allowed to be
398+
passed / executed.
399+
400+
=item bled
401+
402+
The number of messages routed to the :bleed Supply.
403+
404+
=item buffered
405+
406+
The number of messages currently buffered because of overflow.
407+
408+
=item emitted
409+
410+
The number of messages emitted (passed through).
411+
412+
=item id
413+
414+
The id of this status message (a monotonically increasing number). Handy
415+
if you want to log status messages.
416+
417+
=item limit
418+
419+
The current limit that is being applied.
420+
421+
=item vent-at
422+
423+
The maximum number of messages that may be buffered before they're
424+
automatically re-routed to the :bleed Supply.
425+
426+
=back
427+
428+
The :bleed named parameter optionally specifies a Supply that will receive
429+
any values that were either explicitly bled (with the B<bleed> control
430+
message), or automatically bled (if there's a B<vent-at> active).
431+
432+
The :vent-at named parameter indicates the number of values that may be
433+
buffered before any additional value will be routed to the :bleed Supply.
434+
Defaults to 0 if not specified (causing no automatic bleeding to happen).
435+
Only makes sense if a :bleed Supply has also been specified.
436+
437+
The :scheduler named parameter indicates the scheduler to be used. Defaults
438+
to $*SCHEDULER.
439+
440+
=head3 control messages
441+
442+
These messages can be sent to the :control Supply. A control message
443+
consists of a string of the form "key: value", e.g. "limit: 4".
444+
445+
=over 2
446+
447+
=item limit
448+
449+
Change the number of messages (as initially given in the first positional)
450+
to the value given.
451+
452+
=item bleed
453+
454+
Route the given number of buffered messages to the :bleed Supply.
455+
456+
=item vent-at
457+
458+
Change the maximum number of buffered values before automatic bleeding
459+
takes place. If the value is lower than before, will cause immediate
460+
rerouting of buffered values to match the new maximum.
461+
462+
=item status
463+
464+
Send a status message to the :status Supply with the given id.
465+
466+
=back
355467
356468
=head2 method stable
357469
@@ -472,7 +584,7 @@ supplies are done. Can also be called as a class method.
472584
473585
=head2 method zip-latest
474586
475-
method zip(Supply @*supplies, :&with = &[,], :$initial) returns Supply:D
587+
method zip-latest(Supply @*supplies, :&with = &[,], :$initial) returns Supply:D
476588
477589
Creates a supply that emits combined values as soon as there is a new value
478590
seen on B<any> of the supplies. By default, C<Lists|/type/List> are

0 commit comments

Comments
 (0)