unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Mark H Weaver <mhw@netris.org>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: proposal: scm_c_public_ref et al
Date: Sun, 06 Mar 2011 22:10:48 +0100	[thread overview]
Message-ID: <m3vczwaraf.fsf@unquote.localdomain> (raw)
In-Reply-To: <874o7g1ake.fsf@netris.org> (Mark H. Weaver's message of "Sun, 06 Mar 2011 11:24:33 -0500")

On Sun 06 Mar 2011 17:24, Mark H Weaver <mhw@netris.org> writes:

> Andy Wingo <wingo@pobox.com> writes:
>>     SCM scm_c_public_lookup (const char *module_name, const char *name);
>>     SCM scm_c_private_lookup (const char *module_name, const char *name);
>>     SCM scm_c_public_ref (const char *module_name, const char *name);
>>     SCM scm_c_private_ref (const char *module_name, const char *name);
>>
>>     Like the above, but with locale-encoded C strings, for convenience.
>>     Module names are encoded as for `scm_c_resolve_module'.
>
> Given that the C strings passed to these functions will more often than
> not be embedded in the source code, it seems to me that it's a mistake
> assume that they are encoded in the current locale.  The current locale
> is normally the locale of the user, which may be different from the
> locale that the source code is written in.
>
> Maybe utf8 is a better choice?

I thought about this, yes, and you're probably right.  However the other
scm_c_ functions in modules.h (and other files) use locale encoding.
That's probably not something we can change in 2.0.x, and it seemed at
the time that consistency was best.  (Or can we change them?  Does it
matter?)

If we were to choose a particular encoding to make convenient, I would
prefer latin1, because it is common, particularly efficient for Guile
(e.g. scm_from_latin1_symbol), and does not raise runtime errors.  That
does not sacrifice generality, as one can always use
scm_from_utf8_symbol or others, and use the SCM-accepting interface.

Humm.  What do you think about having these procedures take latin1?  We
can probably cast it as a compatibility-preserving change, with regards
to 1.8, which would always treat incoming strings as one byte per char.

Andy
-- 
http://wingolog.org/



  parent reply	other threads:[~2011-03-06 21:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-06 11:24 proposal: scm_c_public_ref et al Andy Wingo
2011-03-06 16:24 ` Mark H Weaver
2011-03-06 17:10   ` Thien-Thi Nguyen
2011-03-06 21:34     ` Andy Wingo
2011-03-06 21:10   ` Andy Wingo [this message]
2011-03-06 22:22 ` Ludovic Courtès
2011-03-07 10:45   ` Andy Wingo

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=m3vczwaraf.fsf@unquote.localdomain \
    --to=wingo@pobox.com \
    --cc=guile-devel@gnu.org \
    --cc=mhw@netris.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).