Open p5pRT opened 7 years ago
On 07/20/2017 07:50 AM\, Tony Cook via RT wrote:
On Tue\, 18 Jul 2017 23:58:39 -0700\, tonyc wrote:
which could perhaps use some expansion in perlunicode. perlunitut covers this reasonably well.
I'm not sure where the cheat sheet following belongs\, though perlunifaq covers some of it (though using Encode instead of utf8::*). Attached is a series of patches (as a single file)\, the first three fix some minor problems with the unicode documentation I found when going through it.
The fourth re-works the documentation in utf8.pm\, taking bits from my little cheat sheet and hopefully putting them in the right places.
Thank you\, Tony.
I have only two small nit-pickings on the patch: There's a typo for "convert" (says "comvert") and it uses "$a" in one of the examples which I think should be "$x" or some unreserved variable name\, to avoid confusion.
On 07/20/2017 09:23 AM\, Sawyer X wrote:
On 07/20/2017 07:50 AM\, Tony Cook via RT wrote:
On Tue\, 18 Jul 2017 23:58:39 -0700\, tonyc wrote:
which could perhaps use some expansion in perlunicode. perlunitut covers this reasonably well.
I'm not sure where the cheat sheet following belongs\, though perlunifaq covers some of it (though using Encode instead of utf8::*). Attached is a series of patches (as a single file)\, the first three fix some minor problems with the unicode documentation I found when going through it.
The fourth re-works the documentation in utf8.pm\, taking bits from my little cheat sheet and hopefully putting them in the right places. Thank you\, Tony.
I have only two small nit-pickings on the patch: There's a typo for "convert" (says "comvert") and it uses "$a" in one of the examples which I think should be "$x" or some unreserved variable name\, to avoid confusion.
For what it's worth\, this received an offline +1 from rgs. :)
On Thu\, Jul 20\, 2017 at 09:23:44AM +0200\, Sawyer X wrote:
On 07/20/2017 07:50 AM\, Tony Cook via RT wrote:
On Tue\, 18 Jul 2017 23:58:39 -0700\, tonyc wrote:
which could perhaps use some expansion in perlunicode. perlunitut covers this reasonably well.
I'm not sure where the cheat sheet following belongs\, though perlunifaq covers some of it (though using Encode instead of utf8::*). Attached is a series of patches (as a single file)\, the first three fix some minor problems with the unicode documentation I found when going through it.
The fourth re-works the documentation in utf8.pm\, taking bits from my little cheat sheet and hopefully putting them in the right places.
Thank you\, Tony.
I have only two small nit-pickings on the patch: There's a typo for "convert" (says "comvert") and it uses "$a" in one of the examples which I think should be "$x" or some unreserved variable name\, to avoid confusion.
Updated patch attached.
Any opinions on whether the reference to C\<use utf8;> modified by the first patch should be removed?
It's still misleading ("abc" in the scope of use utf8; isn't SVf_UTF8 marked)\, which isn't a big deal\, until we do "abc\xDF" which also isn't marked.
Tony
+1
(Except "$a" still appears in the comments next to the lines that now say "$x". Sorry.)
On 07/21/2017 03:40 AM\, Tony Cook wrote:
On Thu\, Jul 20\, 2017 at 09:23:44AM +0200\, Sawyer X wrote:
On 07/20/2017 07:50 AM\, Tony Cook via RT wrote:
On Tue\, 18 Jul 2017 23:58:39 -0700\, tonyc wrote:
which could perhaps use some expansion in perlunicode. perlunitut covers this reasonably well.
I'm not sure where the cheat sheet following belongs\, though perlunifaq covers some of it (though using Encode instead of utf8::*). Attached is a series of patches (as a single file)\, the first three fix some minor problems with the unicode documentation I found when going through it.
The fourth re-works the documentation in utf8.pm\, taking bits from my little cheat sheet and hopefully putting them in the right places. Thank you\, Tony.
I have only two small nit-pickings on the patch: There's a typo for "convert" (says "comvert") and it uses "$a" in one of the examples which I think should be "$x" or some unreserved variable name\, to avoid confusion. Updated patch attached.
Any opinions on whether the reference to C\<use utf8;> modified by the first patch should be removed?
It's still misleading ("abc" in the scope of use utf8; isn't SVf_UTF8 marked)\, which isn't a big deal\, until we do "abc\xDF" which also isn't marked.
Tony
On Fri\, 21 Jul 2017 02:02:08 -0700\, xsawyerx@gmail.com wrote:
+1
(Except "$a" still appears in the comments next to the lines that now say "$x". Sorry.)
Fixed and applied as e423fa83496ce7d83b137bd7f0852864b6073b36\, 01c3fbbc0d1b54bb0dd6fdc0abed7854e62c6717\, ee329aefb9c0bfcee0e6cc41dcd6eb8b03206f30 and 0397beb0d12565d70e168bfea7376e2612a6748a.
Is there anything else we should do to avoid mis-use of these functions?
I previously said:
Using this flag to decide whether a string should be treated as already encoded bytes or characters is wrong\, this should be decided as part of the interface of your function. which could perhaps use some expansion in perlunicode. perlunitut covers this reasonably well.
I'm referring to "I/O flow (the actual 5 minute tutorial)"\, should this be expanded elsewhere?
I don't think it should be expanded in perlunitut.
Tony
On Sunday 23 July 2017 18:57:43 Tony Cook via RT wrote:
On Fri\, 21 Jul 2017 02:02:08 -0700\, xsawyerx@gmail.com wrote:
+1
(Except "$a" still appears in the comments next to the lines that now say "$x". Sorry.)
Fixed and applied as e423fa83496ce7d83b137bd7f0852864b6073b36\, 01c3fbbc0d1b54bb0dd6fdc0abed7854e62c6717\, ee329aefb9c0bfcee0e6cc41dcd6eb8b03206f30 and 0397beb0d12565d70e168bfea7376e2612a6748a.
Just one note:
+Similar to: + + use Encode; + $x = Encode::encode("utf8"\, $x); +
Maybe instead of "utf8" we should show "UTF-8" to users/developers in examples. So if they are using Encode::encode they would get "correct" UTF-8 output and not perl's extended utf8.
In commit 8e179dd8df306c5088bf6c15b494826d48278928 was replaced usage of Encode "utf8" by "UTF-8" as it is better for people doing copy+paste without context.
On Sunday 23 July 2017 18:57:43 Tony Cook via RT wrote:
Is there anything else we should do to avoid mis-use of these functions?
The most useful and legitimate are those functions: utf8::encode utf8::decode utf8::native_to_unicode utf8::unicode_to_native
What about moving them "upper" in synopsis and also in description? So first we show users those functions which they probably want to use in their code\, and after describe those upgrade/downgrade/is_utf8...
Probably adding "[INTERNAL]" description\, like is for utf8::valid could help too.
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.
Migrated from rt.perl.org#131685 (status was 'open')
Searchable as RT131685$