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

Re: on the almost impossibility to write correct XS modules

From:
demerphq
Date:
May 21, 2008 09:33
Subject:
Re: on the almost impossibility to write correct XS modules
Message ID:
9b18b3110805210933v6eb41180xec0e7c0e6d182c6d@mail.gmail.com
2008/5/21 Juerd Waalboer <juerd@convolution.nl>:
> 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.

Cheers,
yves



-- 
perl -Mre=debug -e "/just|another|perl|hacker/"



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