develooper Front page | perl.perl5.porters | Postings from June 2020

Re: Encoding WAS Re: Announcing Perl 7

Thread Previous | Thread Next
From:
Dan Book
Date:
June 29, 2020 23:51
Subject:
Re: Encoding WAS Re: Announcing Perl 7
Message ID:
CABMkAVXUSExUigNWLPcYyo0BoW_fR8yGBKtbPtCOivQhVi3Tdw@mail.gmail.com
On Mon, Jun 29, 2020 at 7:46 PM Felipe Gasper <felipe@felipegasper.com>
wrote:

>
> > On Jun 29, 2020, at 6:59 PM, Eric Brine <ikegami@adaelis.com> wrote:
> >
> > Sawyer X speaks of making it easy to accept newcomers, and I think one
> of the biggest difficulties facing newcomers is dealing with encoding and
> decoding.
>
> I know seasoned Perl developers who struggle with Perl’s character
> encoding logic. Until embarrassingly-recently I was one of them, and I’m
> still a bit nervous to claim I now understand it.
>
> It *IS* fairly simple, I think, once the crucial pieces “click” mentally.
> But that “click” is, IMO, far from “default”. And, like reference-counting
> in C, it’s fiendishly easy to make a subtle mistake that may not manifest
> until you’re far removed from the context where the bug is.
>
> Perl’s “happy confusion” between character-vs.-byte strings is a stumbling
> block for so many. It aggravates the learning curve for newcomers and
> complicates IPC with other languages. If we could somehow have
> “introspectable” string types--strings that “know” whether they represent
> octets or characters--I think that would be a boon for everyone.


100% agreed. I plan to write a blog post at some point on how strings work
in Perl currently but a feature that allows one to declare explicit
intentions as magic attached to strings would be the beginnings of a very
useful system to help people who don't understand the setup or how one
should approach character encoding, and as you mentioned this is far from
just Perl newcomers.

-Dan

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