Skip to content

Commit

Permalink
Fix type formatting for several files.
Browse files Browse the repository at this point in the history
(and some very minor textual cleanups)
  • Loading branch information
coke committed May 20, 2024
1 parent 12859b2 commit 1de9581
Show file tree
Hide file tree
Showing 14 changed files with 368 additions and 371 deletions.
280 changes: 139 additions & 141 deletions doc/Type/Any.rakudoc

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions doc/Type/Associative.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

A common role for types that support name-based lookup through
L«postcircumfix:<{ }>|/language/operators#postcircumfix_{_}» such as
L<Hash|/type/Hash> and L<Map|/type/Map>. It is used for type checks in operators
L<C<Hash>|/type/Hash> and L<C<Map>|/type/Map>. It is used for type checks in operators
that expect to find specific methods to call. See
L<Subscripts|/language/subscripts#Methods_to_implement_for_associative_subscripting>
for details.
Expand All @@ -23,7 +23,7 @@ my %whatever := Whatever.new;
=end code

Please note that we are using binding C<:=> here, since by default C<%>
assignments expect a C<Hash> in the right-hand side, and thus assignment
assignments expect a L<C<Hash>|/type/Hash> in the right-hand side, and thus assignment
would try and convert it to a hash (also failing). However, with the
Associative role:

Expand All @@ -41,8 +41,8 @@ will be syntactically correct.
C<Associative>, as the definition above shows, is actually a
L<parameterized role|/language/objects#Parameterized_roles>
which can use different classes for keys and values. As seen at the top of the
document, by default it coerces the key to C<Str> and uses a very
generic C<Mu> for value.
document, by default it coerces the key to L<C<Str>|/type/Str> and uses a very
generic L<C<Mu>|/type/Mu> for value.

my %any-hash;
say %any-hash.of; # OUTPUT: «(Mu)␤»
Expand All @@ -58,8 +58,8 @@ particular classes:

method keyof()

Returns the parameterized key used for the Associative role, which is C<Any>
coerced to C<Str> by default. This is the class used as second parameter when
Returns the parameterized key used for the Associative role, which is L<C<Any>|/type/Any>
coerced to L<C<Str>|/type/Str> by default. This is the class used as second parameter when
you use the parameterized version of Associative.

my %any-hash;
Expand Down Expand Up @@ -87,7 +87,7 @@ say What.new{33}; # OUTPUT: «42␤»

method EXISTS-KEY(\key)

Should return a C<Bool> indicating whether the given key actually has a value.
Should return a L<C<Bool>|/type/Bool> indicating whether the given key actually has a value.

=head2 method STORE

Expand All @@ -101,7 +101,7 @@ my %h is Foo = a => 42, b => 666;
syntax for binding your implementation of the C<Associative> role.

Should accept the values to (re-)initialize the object with, which either
could consist of C<Pair>s, or separate key/value pairs. The optional
could consist of L<C<Pair>|/type/Pair>s, or separate key/value pairs. The optional
named parameter will contain a C<True> value when the method is called on
the object for the first time. Should return the invocant.

Expand Down
4 changes: 2 additions & 2 deletions doc/Type/Attribute.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ explicitly.

=head2 X<Trait is default|Traits,is default (Attribute)>

An attribute that is assigned L<Nil|/type/Nil> will revert to its default value
An attribute that is assigned L<C<Nil>|/type/Nil> will revert to its default value
set with the trait C<is default>. In the case of arrays or associatives, the
argument of C<is default> will set the default item value or hash value.

Expand Down Expand Up @@ -231,7 +231,7 @@ attributes marked as C<is rw>.

method required(Attribute:D: --> Any:D)

Returns C<1> for attributes that have the "is required" trait applied, or C<Mu>
Returns C<1> for attributes that have the "is required" trait applied, or L<C<Mu>|/type/Mu>
if the attribute did not have that trait applied. If the "is required" trait
is applied with a string, then that string will be returned instead of C<1>.

Expand Down
2 changes: 1 addition & 1 deletion doc/Type/Backtrace/Frame.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ C<is hidden-from-backtrace> trait.
method is-routine(Backtrace::Frame:D: --> Bool:D)

Return C<True> if the frame points into a routine (and not
into a mere L<Block|/type/Block>).
into a mere L<C<Block>|/type/Block>).

my $bt = Backtrace.new;
my $btf = $bt[0];
Expand Down
16 changes: 8 additions & 8 deletions doc/Type/CallFrame.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class CallFrame {}

A CallFrame will be usually captured from the
A C<CallFrame> will be usually captured from the
current state of a program using the L<callframe|/routine/callframe> subroutine.

my $frame = callframe;
Expand Down Expand Up @@ -55,8 +55,8 @@ of the caller using the C<callframe> interface.

calling-frame;

If you just need to trace caller information, L<Backtrace|/type/Backtrace> may
provide a better means of getting it. L<CallFrame|/type/CallFrame>
If you just need to trace caller information, L<C<Backtrace>|/type/Backtrace> may
provide a better means of getting it. C<CallFrame>
contains more information about a specific frame, but provides a tedious
interface for enumerating a call stack.

Expand All @@ -78,7 +78,7 @@ my $frame;
for ^3 { FIRST $frame = callframe; say $_ * 3 };
say $frame.code()

The C<$frame> variable will hold the C<Code> for the block inside the loop in
The C<$frame> variable will hold the L<C<Code>|/type/Code> for the block inside the loop in
this case.

=head2 method file
Expand All @@ -105,7 +105,7 @@ following two calls are identical.

method annotations()

Returns a L<Map|/type/Map> containing the invocants annotations, i.e. C<line>
Returns a L<C<Map>|/type/Map> containing the invocants annotations, i.e. C<line>
and C<file>. An easier way to get hold of the annotation information is to use
one of the convenience methods instead.

Expand All @@ -116,7 +116,7 @@ one of the convenience methods instead.

method my()

Return a L<Hash|/type/Hash> that names all the variables and their values
Return a L<C<Hash>|/type/Hash> that names all the variables and their values
associated with the lexical scope of the frame.

sub some-value {
Expand All @@ -133,11 +133,11 @@ associated with the lexical scope of the frame.

sub callframe(Int:D $level = 0)

Returns a L<CallFrame|/type/CallFrame> object for the given level. If no level
Returns a C<CallFrame> object for the given level. If no level
is given, the default level is 0. Positive levels move up the frame stack and
negative levels move down (into the call to C<callframe> and deeper).

Returns L<Mu|/type/Mu> if there is no call information for the given level.
Returns L<C<Mu>|/type/Mu> if there is no call information for the given level.
Negative levels may result in an exception.

=end pod
44 changes: 22 additions & 22 deletions doc/Type/Channel.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Further examples can be found in the L<concurrency page|/language/concurrency#Ch
method send(Channel:D: \item)

Enqueues an item into the C<Channel>. Throws an exception of type
L<X::Channel::SendOnClosed|/type/X::Channel::SendOnClosed> if the channel has been
L<C<X::Channel::SendOnClosed>|/type/X::Channel::SendOnClosed> if the C<Channel> has been
closed already. This call will B<not> block waiting for a consumer to take the object.
There is no set limit on the number of items that may be queued, so
care should be taken to prevent runaway queueing.
Expand All @@ -47,15 +47,15 @@ care should be taken to prevent runaway queueing.

method receive(Channel:D:)

Receives and removes an item from the channel. It blocks if no item is
Receives and removes an item from the C<Channel>. It blocks if no item is
present, waiting for a C<send> from another thread.

Throws an exception of
type L<X::Channel::ReceiveOnClosed|/type/X::Channel::ReceiveOnClosed> if the channel
type L<C<X::Channel::ReceiveOnClosed>|/type/X::Channel::ReceiveOnClosed> if the C<Channel>
has been closed, and the last item has been removed already, or if C<close> is called
while C<receive> is waiting for an item to arrive.

If the channel has been marked as erratic with method C<fail>, and the last
If the C<Channel> has been marked as erratic with method C<fail>, and the last
item has been removed, throws the argument that was given to C<fail> as an
exception.

Expand All @@ -69,8 +69,8 @@ See method C<poll> for a non-blocking version that won't throw exceptions.

method poll(Channel:D:)

Receives and removes an item from the channel. If no item is present, returns
C<Nil> instead of waiting.
Receives and removes an item from the C<Channel>. If no item is present, returns
L<C<Nil>|/type/Nil> instead of waiting.

my $c = Channel.new;
Promise.in(2).then: { $c.close; }
Expand All @@ -81,21 +81,21 @@ C<Nil> instead of waiting.
sleep 0.1;
}

See method C<receive> for a blocking version that properly responds to channel
See method C<receive> for a blocking version that properly responds to C<Channel>
closing and failure.

=head2 method close

method close(Channel:D:)

Close the C<Channel>, normally. This makes subsequent C<send> calls die with
L<X::Channel::SendOnClosed|/type/X::Channel::SendOnClosed>. Subsequent calls of
L<C<X::Channel::SendOnClosed>|/type/X::Channel::SendOnClosed>. Subsequent calls of
C<.receive> may still drain any remaining items that were previously sent, but if
the queue is empty, will throw an L<X::Channel::ReceiveOnClosed|/type/X::Channel::ReceiveOnClosed>
exception. Since you can produce a C<Seq> from a Channel by contextualizing to array with C<@()>
or by calling the C<.list> method, these methods will not terminate until the channel has been
the queue is empty, will throw an L<C<X::Channel::ReceiveOnClosed>|/type/X::Channel::ReceiveOnClosed>
exception. Since you can produce a L<C<Seq>|/type/Seq> from a C<Channel> by contextualizing to array with C<@()>
or by calling the C<.list> method, these methods will not terminate until the C<Channel> has been
closed. A L<whenever|/language/concurrency#index-entry-whenever>-block will also
terminate properly on a closed channel.
terminate properly on a closed C<Channel>.

=for code
my $c = Channel.new;
Expand All @@ -112,7 +112,7 @@ phaser to enforce the C<.close> call in this case.

method list(Channel:D:)

Returns a list based on the C<Seq> which will iterate items in the queue and
Returns a list based on the L<C<Seq>|/type/Seq> which will iterate items in the queue and
remove each item from it as it iterates. This can only terminate once the
C<close> method has been called.

Expand All @@ -124,7 +124,7 @@ C<close> method has been called.

method closed(Channel:D: --> Promise:D)

Returns a promise that will be kept once the channel is closed by a call to
Returns a promise that will be kept once the C<Channel> is closed by a call to
method C<close>.

my $c = Channel.new;
Expand All @@ -137,8 +137,8 @@ method C<close>.
method fail(Channel:D: $error)

Closes the C<Channel> (that is, makes subsequent C<send> calls die), and enqueues
the error to be thrown as the final element in the channel. Method C<receive>
will throw that error as an exception. Does nothing if the channel has already
the error to be thrown as the final element in the C<Channel>. Method C<receive>
will throw that error as an exception. Does nothing if the C<Channel> has already
been closed or C<.fail> has already been called on it.

my $c = Channel.new;
Expand All @@ -158,8 +158,8 @@ on the invocant.

method Supply(Channel:D:)

This returns an C<on-demand> L<Supply|/type/Supply> that emits a value for every value
received on the Channel. C<done> will be called on the C<Supply> when the L<Channel|/type/Channel>
This returns an C<on-demand> L<C<Supply>|/type/Supply> that emits a value for every value
received on the C<Channel>. C<done> will be called on the L<C<Supply>|/type/Supply> when the C<Channel>
is closed.

my $c = Channel.new;
Expand All @@ -171,16 +171,16 @@ is closed.
sleep 1;

Multiple calls to this method produce multiple instances of Supply, which compete
over the values from the Channel.
over the values from the C<Channel>.

=head2 sub await

multi sub await(Channel:D)
multi sub await(*@)

Waits until all of one or more channels has a value available, and returns
those values (it calls C<.receive> on the channel). Also works with
L<promises|/type/Promise>.
Waits until all of one or more C<Channel>s has a value available, and returns
those values (it calls C<.receive> on the C<Channel>). Also works with
L<C<Promise>|/type/Promise>s.

my $c = Channel.new;
Promise.in(1).then({$c.send(1)});
Expand Down
6 changes: 3 additions & 3 deletions doc/Type/Code.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ result of the call is returned.

Returns the minimum number of positional arguments that must be passed
in order to call the code object. Any optional or slurpy parameters in the
code object's C<Signature> do not contribute, nor do named parameters.
code object's L<C<Signature>|/type/Signature> do not contribute, nor do named parameters.

sub argless() { }
sub args($a, $b?) { }
Expand All @@ -41,7 +41,7 @@ code object's C<Signature> do not contribute, nor do named parameters.

method assuming(Callable:D $self: |primers)

Returns a new C<Callable> that has been L<primed|/language/glossary#priming>
Returns a new L<C<Callable>|/type/Callable> that has been L<primed|/language/glossary#priming>
with the arguments passed to C<assuming>. In other words, the new function
implements the same behavior as the original, but has the values passed to
C<.assuming> already bound to the corresponding parameters.
Expand Down Expand Up @@ -134,7 +134,7 @@ its parameters.
method cando(Capture $c)

Returns a list of candidates that can be called with the given
L<Capture|/type/Capture>. Since C<Code> objects do not have any multiple
L<C<Capture>|/type/Capture>. Since C<Code> objects do not have any multiple
dispatch, this either returns a list with the object, or an empty list.

my $single = \'a'; # a single argument Capture
Expand Down
4 changes: 2 additions & 2 deletions doc/Type/CompUnit.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Returns the authority information with which the C<CompUnit> object was created

method distribution(--> Distribution:D)

Returns the L<Distribution|/type/Distribution> object with which the C<CompUnit> object was
Returns the L<C<Distribution>|/type/Distribution> object with which the C<CompUnit> object was
created (if any).

=head2 method from
Expand All @@ -43,7 +43,7 @@ Returns whether the C<CompUnit> object originated from a precompiled source.

method repo(--> CompUnit::Repository:D)

Returns the L<CompUnit::Repository|/type/CompUnit::Repository> object with which the C<CompUnit> object
Returns the L<C<CompUnit::Repository>|/type/CompUnit::Repository> object with which the C<CompUnit> object
was created.

=head2 method repo-id
Expand Down
12 changes: 6 additions & 6 deletions doc/Type/ComplexStr.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ say 42+0i ∈ <42+0i 55 1>; # OUTPUT: «False␤»

method new(Complex $i, Str $s)

The constructor requires both the C<Complex> and the C<Str> value, when constructing one
The constructor requires both the L<C<Complex>|/type/Complex> and the L<C<Str>|/type/Str> value, when constructing one
directly the values can be whatever is required:

my $f = ComplexStr.new(42+0i, "forty two (but complicated)");
Expand All @@ -46,7 +46,7 @@ Equivalent to L«C<Mu.Capture>|/type/Mu#method_Capture».

method Complex

Returns the C<Complex> value of the C<ComplexStr>.
Returns the L<C<Complex>|/type/Complex> value of the C<ComplexStr>.

=head2 method Numeric

Expand All @@ -61,9 +61,9 @@ a warning about using an uninitialized value in numeric context and then returns
multi method Real(ComplexStr:D: --> Num:D)
multi method Real(ComplexStr:U: --> Num:D)

Coerces the numeric portion of the invocant to L<Num|/type/Num>. If the imaginary part
Coerces the numeric portion of the invocant to L<C<Num>|/type/Num>. If the imaginary part
isn't L<approximately|/routine/=~=> zero,
coercion L<fails|/routine/fail> with C<X::Numeric::Real>.
coercion L<fails|/routine/fail> with L<C<X::Numeric::Real>|/type/X::Numeric::Real>.

The C<:D> variant returns the result of that coercion. The C<:U> variant issues
a warning about using an uninitialized value in numeric context and then returns value C<0e0>.
Expand All @@ -74,8 +74,8 @@ a warning about using an uninitialized value in numeric context and then returns

multi sub infix:<===>(ComplexStr:D $a, ComplexStr:D $b)

C<ComplexStr> Value identity operator. Returns C<True> if the C<Complex>
values of C<$a> and C<$b> are L<identical|/routine/===> and their C<Str>
C<ComplexStr> Value identity operator. Returns C<True> if the L<C<Complex>|/type/Complex>
values of C<$a> and C<$b> are L<identical|/routine/===> and their L<C<Str>|/type/Str>
values are also L<identical|/routine/===>. Returns C<False> otherwise.

=end pod

0 comments on commit 1de9581

Please sign in to comment.