From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Newsgroups: gmane.lisp.guile.devel Subject: Re: More explicit support for Unicode title case Date: Mon, 21 Dec 2009 21:17:20 +0100 Message-ID: <87d428cca7.fsf@gnu.org> References: <2bc5f8210912210602l5caba56ahb50381f666a59737@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1261426728 27871 80.91.229.12 (21 Dec 2009 20:18:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 21 Dec 2009 20:18:48 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Dec 21 21:18:41 2009 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NMoiG-00020I-Ri for guile-devel@m.gmane.org; Mon, 21 Dec 2009 21:18:41 +0100 Original-Received: from localhost ([127.0.0.1]:58019 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NMoiG-0002ea-Tn for guile-devel@m.gmane.org; Mon, 21 Dec 2009 15:18:40 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NMohW-0002PZ-JC for guile-devel@gnu.org; Mon, 21 Dec 2009 15:17:54 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NMohR-0002Ng-12 for guile-devel@gnu.org; Mon, 21 Dec 2009 15:17:53 -0500 Original-Received: from [199.232.76.173] (port=43030 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NMohQ-0002Nb-UY for guile-devel@gnu.org; Mon, 21 Dec 2009 15:17:48 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:46285) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NMohQ-0001zM-Bj for guile-devel@gnu.org; Mon, 21 Dec 2009 15:17:48 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.50) id 1NMohK-0001bq-Lq for guile-devel@gnu.org; Mon, 21 Dec 2009 21:17:42 +0100 Original-Received: from reverse-83.fdn.fr ([80.67.176.83]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 21 Dec 2009 21:17:42 +0100 Original-Received: from ludo by reverse-83.fdn.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 21 Dec 2009 21:17:42 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 69 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: reverse-83.fdn.fr X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 1 =?iso-8859-1?Q?Niv=F4se?= an 218 de la =?iso-8859-1?Q?R=E9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:unkGIuhjdHUa0o2jkkWSaaV3L0Y= X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:9784 Archived-At: Hi Julian, Julian Graham 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 > 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’.