develooper Front page | perl.perl5.porters | Postings from May 2008

Re: on the almost impossibility to write correct XS modules

May 21, 2008 09:33
Re: on the almost impossibility to write correct XS modules
Message ID:
2008/5/21 Juerd Waalboer <>:
> Glenn Linderman skribis 2008-05-21  8:50 (-0700):
>> On approximately 5/21/2008 1:29 AM, came the following characters from
>> the keyboard of Rafael Garcia-Suarez:
>> >Some way to mark PVs as "binary" and not upgradeable to SvUTF8 would be
>> >handy, though.
>> What's the goal?
> Dual:
> 1. To provide a means of indicating that something is binary rather than
> text. This can be useful in an encoding capable DBI drivers/wrappers for
> example, to indicate that a "?" placeholder is already binary, and
> should not be text-encoded. (You'd want to do this based on column
> introspection but that's very slow and very hard to write portably.)
> Another use case involves data serialization for exchange with languages
> that have native binary strings, like Java.
> 2. To prevent programming errors; you should see this as a matter of
> strictures. Most silly mistakes made in Unicode programming are related
> to people who fail to understand the difference between binary and text
> strings, and as a result from that, they sometimes add text strings to
> binary strings. While conceptually that's always a mistake, it happens
> so often and it's such an easy mistake te make (apparently)

Its a natural mistake to make because its the intended way to work
with binary data in perl. Just nobody really appreciated how this fact
and the introduction of widechar would make things complicated.


perl -Mre=debug -e "/just|another|perl|hacker/" Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About