develooper Front page | perl.perl5.porters | Postings from August 2017

Re: [perl #131685] Rename utf8::is_utf8() (and other functions)

Thread Previous | Thread Next
From:
Karl Williamson
Date:
August 2, 2017 05:25
Subject:
Re: [perl #131685] Rename utf8::is_utf8() (and other functions)
Message ID:
802d5ebf-647a-60b5-879a-cb4bcb3e25ee@khwilliamson.com
On 07/13/2017 08:28 PM, Father Chrysostomos via RT wrote:
> On Wed, 12 Jul 2017 21:55:03 -0700, public@khwilliamson.com wrote:
>> I guess we have a fundamental disagreement about language design and
>> the
>> direction Perl should go, which makes me sad.
> 
> I agree the disagreement is unfortunate.
> 
>>
>> The point of adding synonyms for deceptively-named functions and
>> macros
>> is to make life easier overall.  Forbidding new better-named synonyms
>> for problematically named things forces everyone who comes along to
>> deal
>> with the gotchas and cognitive load that those people already here
>> have
>> had to deal with.  By creating better named things, those people can
>> largely avoid these problems.  This allows them to work more
>> efficiently, avoiding traps, and with less cursing Perl.
> 
> When you first put forward this argument (specifically with regard to av_len), it made sense to me, and I had no objection to it.  Later, people wrote to p5p complaining that the new situation was more confusing; in addition, *I* started to get confused.  That was when I started to have second thoughts.

I searched the archives of p5p for occurrences of av_top_index and 
av_tindex.  There were two complaints I saw before the recent spate. 
One was Marc Lehmann; the other, more recent was Dave Mitchell saying 
av_tindex didn't seem natural to him.

I myself am confused by the previous names, and this helps *me*.  There 
are times when I want to refer to the highest element.  And there are 
times when the length is the more natural concept.  I would like 
something for these occasions like 'av_true_len'.  Again, if I see 
av_len, I realize it's problematic and I have to slow down to think 
about how it is.  Life is more difficult.
> 
> I think Damian Conway was right when he wrote in PBP that one should not use English (the module).  Since other people use punctuation variables, you are going to have to learn them anyway.  Using the English names just forces others reading your code to look up the names that you are using.  It just creates more cognitive burden.

That tells me that the names were not chosen well enough.  It is an art, 
and few coders are good at it.  I still have learned only a few of the 
punctuation variables.
> 
> I think the same applies even to poorly named functions.  You just have to learn the gotcha once, and then you can use the function and read code that uses it.  (And if you use functions without reading either the documentation or the source, then you are coming close to what I would call autopodotoxy.)
> 
>> Unless Perl is close to death, the number of people who are going to
>> come along before it does die dwarfs the number who are already
>> expert.
>>     Some people are knowledgeable in parts of Perl, but not all.  They
>> also gain if gotchas get removed before they have to deal with them.
> 
> But the gotchas never get removed.  You just end up with a larger pile of functions for people to sift through.  Not to mention a lot of existing (and correct) code that they cannot read without learning the discouraged parlance.  So they have to learn the different forms anyway.
> 
> My personal experience is that what you are arguing for, while it sounds good, does not work in practice.
> 

If you assume that new Perl XS programmers are mostly going to be 
reading old code that uses these constructs, yes they will have to learn 
them at some point.  And, encountering those constructs will likely slow 
them down each time.  But my hope is that there will be plenty of new 
Perl programmers programming Perl and XS on new projects, and they 
shouldn't have to be burdened by the past.

My father was good at double-clutching.  He used that, the story goes, 
to save a tourist bus whose brakes had failed that he was driving down, 
a steep slope.  He tried to teach me that art, and I did it a few times, 
but transmissions had gotten better, and I never had to do it, and 
couldn't do it now.  Nowadays most people don't even know what it is, 
nor should they have to be burdened by a skill that technology has made 
essentially obsolete.

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