develooper Front page | perl.perl5.porters | Postings from January 2012

Confounded [was: pack and ASCII]

Thread Previous | Thread Next
From:
Aristotle Pagaltzis
Date:
January 16, 2012 02:12
Subject:
Confounded [was: pack and ASCII]
Message ID:
20120116101156.GJ817@fernweh.plasmasturm.org
* demerphq <demerphq@gmail.com> [2012-01-12 18:50]:
> On 12 January 2012 18:21, Eric Brine <ikegami@adaelis.com> wrote:
> >The only example was showed that print works as I said things should
> >work: downgrade when bytes are expected, give an error if not
> >possible.
>
> Downgrading is not the same as accessing the raw bytes in a string.
>
> Just because bytes are expected does not mean that the right way to
> get them is to _downgrade_ the string.

Yes it is.

If you have a byte string represented by a UTF8=1 scalar, then the PV
buffer has a UTF8-encoded sequence of 8-bit integer values. To get the
value of each string element, which here represents one byte each, into
an actual byte, you have to do the equivalent of downgrading.

You might as well actually downgrade.

So downgrading *is* the way to get bytes from a scalar that contains
a byte string.

It took me a while to figure out how to respond to you because I think
you understand this matter, but what you disagreed with seemed correct
to me, so it is probably for purely terminological reasons that people
have been violently agreeing about all this – to the tune of almost
three quarter-hundred mails on thread.

I am not certain you agree with the above, but if so I couldn’t tell.

We desperately need at least two extra terms – one to disambiguate
platonic characters from atomic string elements (which can be either
platonic characters or platonic bytes), and one to disambiguate bytes
as in the underlying PV buffer representation of a string from platonic
bytes as atomic elements of the string at the Perl semantic level. Maybe
we even need more terms yet, which I didn’t think of here.

Until then, threads like this will be exercises in confusion as people
mean different things when they say the same words – in fact often mean
the same different things, only at opposite times, making communication
all but an accident: no one can either hear what the other truly is
saying or likewise truly be heard in turn.

The tower of Babel comes to mind.

Reverently,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>

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