develooper Front page | perl.perl5.porters | Postings from February 2000

Re: should "use byte" be "use bytes"?

From:
Mark Mielke
Date:
February 9, 2000 11:53
Subject:
Re: should "use byte" be "use bytes"?
Message ID:
20000209145441.A3801@pcard12x.ca.nortel.com
On Wed, Feb 09, 2000 at 11:15:34AM -0800, "Larry Wall" wrote:
> Gurusamy Sarathy writes:
> : On Wed, 09 Feb 2000 10:19:38 PST, Larry Wall wrote:
> : >    use byte;			# old perl semantics
> : Hey, shouldn't we s/byte/bytes/ like we did for warnings?
> Yes, I cringe every time I write "use byte".
> I keep wondering if there's something out there better than "bytes", though.
>...
>     octets
>...

I prefer octets, as that is what all the RFC's seem to call them. This
would be similar to "use integer;" for numbers, "use octet;" for strings
would limit it to 8 bit characters. (Note that it isn't "use integers;",
it is "use integer;")

I'd stay away from calling them ascii or latin1, as they are merely
code dictionaries mapping codes to symbols. Just because ascii only
defines up to 128 codes, doesn't mean that it cannot be represented in
a any 7+ bit integer. Proof?  UTF-8 encompasses ascii. Ascii is a
subset of UTF-8.

Use of ascii, latin1, etc. should be reserved for character
conversions. Just because ascii happens to be a subset of latin1, and
a subset of UTF-8 is mostly just a coincidence. The functionality
provided by the current "use byte;" is that any such assumptions about
encodings are discarded, and all strings are viewed plainly as a
string of octets with complete disregard to encoding.

mark

-- 
markm@nortelnetworks.com/mark@mielke.cc/markm@ncf.ca __________________________
.  .  _  ._  . .   .__    .  . ._. .__ .   . . .__  | Fun Loving Coder
|\/| |_| |_| |/    |_     |\/|  |  |_  |   |/  |_   | Nortel Networks
|  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, Ontario, Canada

  One ring to rule them all, one ring to find them, one ring to bring them all
                       and in the darkness bind them...

                           http://mark.mielke.cc/




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