guile-devel
[Top][All Lists]
Advanced

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

Re: More explicit support for Unicode title case


From: Ludovic Courtès
Subject: Re: More explicit support for Unicode title case
Date: Mon, 21 Dec 2009 21:17:20 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Hi Julian,

Julian Graham <address@hidden> writes:

> I was doing some auditing of Guile's support for the functionality
> required by the R6RS "Standard Libraries" specification, and I noticed
> that Guile's character and string APIs are missing support for
> title-cased Unicode characters [0].  ...So I added it.
>
> Find attached a patch (including documentation and unit tests) that
> adds title case-related functions as appropriate to the areas of the
> system that deal with character case.  In particular, the core
> character API, SRFI-13, and i18n are affected.

Excellent!  Overall this looks good to me.

A few notes:

> From 82052a10da40a6d814ab30a944859c83bb6fe68e Mon Sep 17 00:00:00 2001
> From: Julian Graham <address@hidden>
> Date: Mon, 21 Dec 2009 08:46:49 -0500
> Subject: [PATCH] Improved support for Unicode title case in Guile's string 
> and character APIs.
>
> * doc/ref/api-data.texi (Characters): Documentation for `char-title-case?' 
> and `char-titlecase'.
> * doc/ref/api-i18n.texi (Character Case Mapping): Documentation for 
> `char-locale-titlecase' and `string-locale-titlecase'.

Please wrap lines to 80 characters.

> address@hidden {Scheme Procedure} char-title-case? chr
> address@hidden {C Function} scm_char_title_case_p (chr)
> +Return @code{#t} iff @var{chr} is titlecase, else @code{#f}.

I’d remove this function altogether because with SRFI-14 one can just
use ‘(char-set-contains? char-set:title-case chr)’ if that’s what’s
intended.  Given the definition of ‘char-set:title-case’, I expect it to
be rarely useful, though.

What do you think?

> address@hidden char-titlecase
> address@hidden {Scheme Procedure} char-titlecase chr
> address@hidden {C Function} scm_char_titlecase (chr)
> +Return the titlecase character version of @var{chr} if one exists;
> +otherwise return the uppercase version.
> address@hidden deffn

At first I wondered how this would differ from ‘char-upcase’.  IIUC it
differs in a few cases, namely Dž and the other members of
‘char-set:title-case’.  I think it’d be nice to mention at least one
example to illustrate the difference.

> +SCM_API scm_t_wchar scm_c_titlecase (scm_t_wchar c);

I think it should be documented in the manual.

> +  (pass-if "char-locale-titlecase-Dz"

Maybe “char-locale-titlecase Dž”.

> +  (pass-if "string-locale-titlecase"
> +    (and (string=? "Tt" (string-locale-titlecase "tt"))

Maybe a longer string otherwise it looks as though it were one of these
special cases.  ;-)

Feel free to commit modulo these small things.

Thanks,
Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]