develooper Front page | perl.perl6.users | Postings from April 2018

Blob - what am I missing?

Thread Next
Fernando Santagata
April 17, 2018 08:50
Blob - what am I missing?
Message ID:
I'm experimenting with Blob(s) and I'm under the impression that I don't
understand how they work.

The documentation for the allocate() method ( reads:

Returns a newly created Blob object with the given number of elements.

but when I try it in the REPL, I get strange results:

> my Blob $b0.allocate(10, 0)
Blob:0x<00 00 00 00 00 00 00 00 00 00>
> $b0.WHAT
> $b0.bytes
Invocant of method 'bytes' must be an object instance of type 'Blob', not a
type object of type 'Blob'.  Did you forget a '.new'?
  in block <unit> at <unknown file> line 1

> my Blob $b1 .= new;
> $b1.WHAT
> $b1.bytes

Apparently allocate() doesn't return a "newly created Blob object," or am I
missing something?

(using 2018.03)

Fernando Santagata

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About