develooper Front page | perl.perl6.users | Postings from February 2019

Re: Fastest way to convert from a Buf to a Str?

Thread Previous | Thread Next
Darren Duncan
February 4, 2019 01:43
Re: Fastest way to convert from a Buf to a Str?
Message ID:
On 2019-02-02 7:22 PM, ToddAndMargo via perl6-users wrote:
> I need to read a file into a buffer (NO CONVERSIONS!)
> and then convert it to a string (again with no
> conversions).

I think you're making an impossible request.  If preserving exact bytes is 
important, then you want to keep your data in a type that represents a sequence 
of bytes, such as Blob of Buf.  A Str represents a sequence of characters, which 
are NOT bytes, so if you're wanting to have a Str that is saying you don't care 
about the bytes.  Given what you keep saying, I'd say skip the Str and just use 
Buf or Blob etc full stop. -- Darren Duncan

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