unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: guile-devel@gnu.org
Subject: Re: More explicit support for Unicode title case
Date: Mon, 21 Dec 2009 21:17:20 +0100	[thread overview]
Message-ID: <87d428cca7.fsf@gnu.org> (raw)
In-Reply-To: 2bc5f8210912210602l5caba56ahb50381f666a59737@mail.gmail.com

Hi Julian,

Julian Graham <joolean@gmail.com> 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 <julian.graham@aya.yale.edu>
> 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.

> +@deffn {Scheme Procedure} char-title-case? chr
> +@deffnx {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?

> +@rnindex char-titlecase
> +@deffn {Scheme Procedure} char-titlecase chr
> +@deffnx {C Function} scm_char_titlecase (chr)
> +Return the titlecase character version of @var{chr} if one exists;
> +otherwise return the uppercase version.
> +@end 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	other threads:[~2009-12-21 20:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-21 14:02 More explicit support for Unicode title case Julian Graham
2009-12-21 20:17 ` Ludovic Courtès [this message]
2009-12-22  5:37   ` Julian Graham
2009-12-22  7:16     ` Mike Gran
2009-12-28 22:28       ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d428cca7.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).