From: ludo@chbouib.org (Ludovic Courtès)
Subject: Re: More i18n
Date: Wed, 24 Jan 2007 00:44:59 +0100 [thread overview]
Message-ID: <87mz49patg.fsf@chbouib.org> (raw)
In-Reply-To: 871wlmwox1.fsf@zip.com.au
Hi Kevin,
I basically agree with most of your remarks. Here are some I don't
quite agree with or that deserve discussion.
Kevin Ryde <user42@zip.com.au> writes:
>> +* i18n Introduction:: Introduction to Guile's i18n support.
>
> "i18n" is a horrible geek-ish abbreviation, much better written in
> full in the manual.
Agreed, but that's only the name of the Info node. Changing it here
would make the line too long for Info.
>> +@defvr {Scheme Variable} %global-locale
>
> I'm worried if that should be a variable, rather than a function.
I wondered too. My conclusion is that there's nothing to be afraid of:
after all, it's a special object and we have full control over it
(pretty much like the EOF object, for instance[*]).
>> +This function is based on the C library's @code{strtod} function
>
> Not any more? Or just in a broadly similar style?
It's based on `strtod', really---I think you're mixing this and
`number->locale-string'.
>> +@deffn {Scheme Procedure} locale-yes-regexp [locale]
>> +@deffnx {Scheme Procedure} locale-no-regexp [locale]
>
> These aren't gnu extensions are they?
No, they're not:
http://www.opengroup.org/onlinepubs/009695399/basedefs/langinfo.h.html
>> +(define (locale-encoding . locale)
>> + (apply nl-langinfo CODESET locale))
>
> I think you should implement almost all these basic bits in C, and not
> have a big nl-langinfo. It'll be easier for a future localeconv
> conditionals, or some of the DOS apis. It'll also be smaller and
> faster to load and run.
>
>> +(define-vector-langinfo-mapping locale-day-short
>> + (ABDAY_1 ABDAY_2 ABDAY_3 ABDAY_4 ABDAY_5 ABDAY_6 ABDAY_7)
>> + ("Sun" "Mon" "Tue" "Wed" "Thu" "Fri" "Sat"))
>
> These in C too I think.
I'm not sure about it. Writing all those bits in C would have clear
short-term advantages, mainly faster loading. That said, beside the
fact that I'm a bit lazy and don't really feel like rewriting the thing
in C ATM ;-), I think the above Scheme constructs are easier to work
with (to maintain, to add `localeconv' support, etc.) than a C
equivalent. So I'd be tempted to keep them as is.
(Besides, I don't think it's very high priority, especially since it
doesn't have any impact on the API itself.)
>> number formatting ...
>>
>> + (let loop ((index (- strlen 1))
>> + (grouping grouping)
>> + (since-separator 0)
>> + (result ""))
>
> Consider breaking out of the loop when grouping is null, and in any
> case going group by group instead of character by character.
Yes, indeed!
> The result could be built as a list of strings to be concatenated at
> the end too (string-concatenate/reverse or whatever it is).
What does it buy us to apply `string-append' at the end rather than
`string-append' at each step?
>> ;;; Local Variables:
>> ;;; coding: latin-1
>
> The fallbacks are all ascii aren't they?
I prefer to explicitly specify the encoding of non-ASCII files.
Thanks for the detailed review!
Ludo'.
[*] Actually, the EOF object _is_ available in R6RS, but it is returned
by the `eof-object' procedure. The following post sheds some light
on this decision:
http://www.r6rs.org/r6rs-editors/2006-July/001536.html . I'm not
sure this reasoning would apply well here: We already have two
implementations of `%global-locale' and both can happily deal with
it.
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
next prev parent reply other threads:[~2007-01-23 23:44 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-10 15:04 More i18n Ludovic Courtès
2006-12-11 19:42 ` Neil Jerram
2006-12-12 9:09 ` Ludovic Courtès
2006-12-12 19:48 ` Kevin Ryde
2006-12-31 16:23 ` Neil Jerram
2006-12-31 16:22 ` Neil Jerram
2006-12-13 0:11 ` Kevin Ryde
2006-12-31 16:54 ` Neil Jerram
2006-12-11 23:26 ` Kevin Ryde
2006-12-12 9:36 ` Ludovic Courtès
2006-12-12 19:43 ` Kevin Ryde
2006-12-12 19:19 ` Kevin Ryde
2006-12-31 16:15 ` Neil Jerram
2007-01-01 22:32 ` Kevin Ryde
2007-01-16 21:46 ` Ludovic Courtès
2007-01-16 22:08 ` Ludovic Courtès
2007-01-23 0:49 ` Kevin Ryde
2007-01-23 0:46 ` Kevin Ryde
2007-01-23 23:44 ` Ludovic Courtès [this message]
2007-01-24 20:58 ` Kevin Ryde
2007-01-31 21:13 ` Ludovic Courtès
2007-01-31 22:06 ` Kevin Ryde
2007-01-25 1:05 ` Kevin Ryde
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=87mz49patg.fsf@chbouib.org \
--to=ludo@chbouib.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).