*From*: Randall Sawyer <srandallsawyer hushmail me>*To*: Behdad Esfahbod <behdad behdad org>, Matthias Clasen <matthias clasen gmail com>*Cc*: gtk-devel-list <gtk-devel-list gnome org>*Subject*: Re: G_UTF8String: Boxed Type Proposal*Date*: Mon, 21 Mar 2016 17:58:10 -0400

Thank you once again to all who have responded. I have changed my mind. I DO grasp the nature of responders' objections. My understanding has now reached a "tipping point". What is the tipping point? On 03/21/2016 04:30 PM, Behdad Esfahbod
wrote:
Matthias, I comprehend what you are saying here. As Christian pointed out recently (https://mail.gnome.org/archives/gtk-devel-list/2016-March/msg00037.html), "DRY alone is not a sufficient argument."
The tipping point is the function g_utf8_normalize() - which is called by objects which DO possess a length-of-string in units of UTF 8-code-points ("characters" in Glib parlance). If my proposed idea were to be adopted in a useful way - then every call to any g_utf8_*() function would require that it be wrapped in a g_ustring_*() [previously g_utf8_string_*()] function in order for GUString [previously G_UTF8String] to be truly useful. Time to move on. Along the way - however - I have come up with two functions which I will be proposing and which may very well be useful in a number of certain cases: g_utf8_unilen() - which measures the length of string in UTF-8 sequences ("characters") primarily and in non-nul bytes secondarily g_utf8_offset_to_pointer_sized () - which optimizes its return value by by first comparing byte length to UTF-8 length [for the cases when these are both known] - opting for pointer arithmetic when equal - and then compares UTF-8 offset to UTF-8 length in order to decide whether to parse the first 3/4 of the last 1/4 when calling g_utf8_offset_to_pointer() These last two, I will definitely be submitting as a patch. |

**Follow-Ups**:**Re: G_UTF8String: Boxed Type Proposal***From:*Randall Sawyer

**References**:**G_UTF8String: Boxed Type Proposal***From:*Randall Sawyer

**Re: G_UTF8String: Boxed Type Proposal***From:*Matthias Clasen

**Re: G_UTF8String: Boxed Type Proposal***From:*Randall Sawyer

**Re: G_UTF8String: Boxed Type Proposal***From:*Jasper St. Pierre

**Re: G_UTF8String: Boxed Type Proposal***From:*Matthias Clasen

**Re: G_UTF8String: Boxed Type Proposal***From:*Jasper St. Pierre

**Re: G_UTF8String: Boxed Type Proposal***From:*Matthias Clasen

**Re: G_UTF8String: Boxed Type Proposal***From:*Simon McVittie

**Re: G_UTF8String: Boxed Type Proposal***From:*Matthias Clasen

**Re: G_UTF8String: Boxed Type Proposal***From:*Randall Sawyer

**Re: G_UTF8String: Boxed Type Proposal***From:*Matthias Clasen

**Re: G_UTF8String: Boxed Type Proposal***From:*Behdad Esfahbod

[Date Prev][Date Next] [Thread Prev][Thread Next] [Thread Index] [Date Index] [Author Index]