<?xml version="1.0" encoding="windows-1252"?>
<node id="883864" title="Re^2: Repurposing reverse" created="2011-01-24 01:50:31" updated="2011-01-24 01:50:31">
<type id="11">
note</type>
<author id="381608">
ikegami</author>
<data>
<field name="doctext">
&lt;blockquote&gt;&lt;p&gt;&lt;i&gt;It reverses Unicode code points&lt;/i&gt;&lt;/blockquote&gt;

&lt;p&gt;No. It doesn't know anything about Unicode and there's no requirement for the string to be Unicode text.

&lt;blockquote&gt;&lt;p&gt;&lt;i&gt;not characters in the usual, well-understood sense of the word.&lt;/i&gt;&lt;/blockquote&gt;

&lt;p&gt;In my experience, "character" is the constituent element of a string, and never a grapheme except by happenstance. Let's just say there is no such consensus. Regardless, that's the definition used here.

&lt;blockquote&gt;&lt;p&gt;&lt;i&gt;If I understand the design principles of Perl correctly, the reverse function should properly reverse extended grapheme clusters&lt;/i&gt;&lt;/blockquote&gt;

&lt;p&gt;No. &lt;c&gt;reverse&lt;/c&gt; provides a vital string operation. It should not assume the string is Unicode text. Reversing text is &lt;em&gt;also&lt;/em&gt; a useful function, but it is not provided by &lt;c&gt;reverse&lt;/c&gt;.

&lt;p&gt;Same goes with &lt;c&gt;substr&lt;/c&gt; and &lt;c&gt;length&lt;/c&gt;.

&lt;blockquote&gt;&lt;p&gt;&lt;i&gt;when the thing being reversed is Unicode text (and Perl understands it is Unicode text), and it should reverse bytes otherwise.&lt;/i&gt;&lt;/blockquote&gt;

&lt;p&gt;Perl doesn't have a means of "understanding a string is Unicode text". 
</field>
<field name="root_node">
661510</field>
<field name="parent_node">
881588</field>
</data>
</node>
