develooper Front page | perl.perl5.porters | Postings from March 2001

Re: use bytes; - what does/should it mean?

Thread Previous | Thread Next
From:
Nick Ing-Simmons
Date:
March 12, 2001 08:13
Subject:
Re: use bytes; - what does/should it mean?
Message ID:
200103121612.QAA25748@mikado.tiuk.ti.com
Simon Cozens <simon@netthink.co.uk> writes:
>On Mon, Mar 12, 2001 at 08:50:50AM -0600, Jarkko Hietaniemi wrote:
>> The Hairy Beast is rather sparse and/or vague on "use bytes".
>
>Good! More freedom for us.
>
>> 	In this case, you may put a use bytes declaration around
>> 	the byte-oriented code to force it to use byte semantics
>> 	even on strings marked as utf8 strings. 
>
>This is what I think "use bytes" should do, and currently does.

Not everywhere regardless of which interpretation of "byte semantics" you 
take.

I am essentially asking us to choose between two views of "byte semantics":

A. Strings are still sequences of logical characters. Character values 
   > 255 are truncated modulo 256 with a warning.
   (Which - apart from the warning - is what would have happened in 5.005 etc.)

B. We see whatever is in the guts at the time. 


>
>> In Camel the former is not used.  bytes::length() is used instead.
>> How did we come to think that 'use bytes; length' should be equal
>> to bytes::length?
>
>The Camel also says that "use bytes" defines byte-oriented wrappers around
>functions like length; that would suggest to me that {use bytes; length} 
>is a byte-oriented length.

It also says that which wrappers are provided are subject to change.
It does (sadly) suggest what bytes::length returns in some 
cases but not others.

-- 
Nick Ing-Simmons <nik@tiuk.ti.com>
Via, but not speaking for: Texas Instruments Ltd.


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About