Skip to content

Commit a87cda0

Browse files
committed
Expands allocate refs #2694
1 parent 8c8c8d6 commit a87cda0

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

doc/Type/Blob.pod6

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ Defined as:
1919
multi method new(Blob: Blob:D $blob)
2020
multi method new(Blob: int @values)
2121
multi method new(Blob: @values)
22-
multi method new(Blob: *@values) {
22+
multi method new(Blob: *@values)
2323
2424
25-
Creates an empty C<Blob>, or from another C<Blob>, from a list of integers or
26-
from a list of values
25+
Creates an empty C<Blob>, or a new C<Blob> from another C<Blob>, or from a list
26+
of integers or values (which will have to be coerced into integers):
2727
2828
my $blob = Blob.new([1, 2, 3]);
2929
say Blob.new(<1 2 3>); # OUTPUT: «Blob:0x<01 02 03>␤»
@@ -130,18 +130,26 @@ part of the invocant buffer you would like:
130130
131131
Defined as:
132132
133-
multi method allocate($elems --> Blob:D)
134-
multi method allocate($elems, $pattern --> Blob:D)
133+
multi method allocate(Blob:U: Int:D $elements)
134+
multi method allocate(Blob:U: Int:D $elements, int $value)
135+
multi method allocate(Blob:U: Int:D $elements, Int:D \value)
136+
multi method allocate(Blob:U: Int:D $elements, Mu:D $got)
137+
multi method allocate(Blob:U: Int:D $elements, int @values)
138+
multi method allocate(Blob:U: Int:D $elements, Blob:D $blob)
139+
multi method allocate(Blob:U: Int:D $elements, @values)
135140
136141
Returns a newly created C<Blob> object with the given number of elements.
137-
Optionally takes a second argument that indicates the pattern with which to
138-
fill the C<Blob>: this can be a single integer value, or any C<Iterable>
139-
that generates integer values, including another C<Blob>. The pattern will be repeated if not enough
140-
values are given to fill the entire C<Blob>.
142+
Optionally takes a second argument that indicates the pattern with which to fill
143+
the C<Blob>: this can be a single (possibly native) integer value, or any
144+
C<Iterable> that generates integer values, including another C<Blob>. The
145+
pattern will be repeated if not enough values are given to fill the entire
146+
C<Blob>.
141147
142148
my Blob $b0 = Blob.allocate(10,0);
143149
$b0.say; # OUTPUT: «Blob:0x<00 00 00 00 00 00 00 00 00 00>␤»
144150
151+
If the pattern is a general C<Mu> value, it will fail.
152+
145153
=head2 method unpack
146154
147155
This method is considered B<experimental>, in order to use it you will need to

0 commit comments

Comments
 (0)