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

Re: warding against bytes.pm

Thread Previous | Thread Next
From:
Aristotle Pagaltzis
Date:
January 4, 2010 02:58
Subject:
Re: warding against bytes.pm
Message ID:
20100104105327.GA20492@klangraum.plasmasturm.org
* Dave Mitchell <davem@iabyn.com> [2010-01-04 00:25]:
> Given that, should we add a warning to bytes.pm's pod to the
> effect that you shouldn't be using this for new code unless you
> really know what you're doing

I’m in favour. I’d word it more strongly than that too.


* Steffen Mueller <smueller@cpan.org> [2010-01-04 09:45]:
> 1) If we add such a warning, we make certain assumptions* about
> what the user was trying to do and ended up wanting to use
> bytes.pm.

Very nearly *everything* they would want to do with bytes.pm
would be a mistake. Using bytes.pm in application code (as
opposed to guts hackery) is almost by definition a bug.

> 2) If we assume we have a good idea what she really wanted to
> do, we should add pointers to the right way to do it next to
> the warning.

About the only useful thing I can think of is to point them to
`utf8::downgrade`, which is sometimes us to cope with
buggy XS code.

> Without pointers to the right solution, such a warning wouldn't
> be very helpful.

The only correct thing you can do with bytes.pm is mess around
with the byte buffer of an upgraded string while circumventing
Perl’s own fixed-width/variable-width character conversion
machinery. I would guess that of everyone in the world, maybe
5 guts-hacking CPAN authors will ever need to do that. And they
probably know what they are doing anyway.

Regards,
-- 
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