public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Doug Evans <xdje42@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>,
	 "gdb-patches\@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH v1 02/36] Guile extension language: doc additions
Date: Sat, 18 Jan 2014 20:52:00 -0000	[thread overview]
Message-ID: <87mwitovvh.fsf@gnu.org> (raw)
In-Reply-To: <CAP9bCMTR8Dv7ejLWs0yqeFLja8-fck08kvHHWiJdS09WAG5nbw@mail.gmail.com>	(Doug Evans's message of "Sat, 18 Jan 2014 12:36:06 -0800")

Doug Evans <xdje42@gmail.com> skribis:

> On Sat, Jan 4, 2014 at 3:57 AM, Ludovic Courtès <ludo@gnu.org> wrote:
>>>> >> +A Scheme string is converted to a target string, using the current
>>>> >> +target encoding.
>>>> >
>>>> > What if target encoding doesn't support some of the characters in the
>>>> > string?
>>>>
>>>> Guile’s behavior can be controlled with
>>>> ‘%default-port-conversion-strategy’: it can raise an exception, or
>>>> substitute any characters that could not be converted, or escape them
>>>> (info "(guile) Ports").
>>>>
>>>> Perhaps this should be briefly mentioned, with a cross-ref.
>>>
>>> It should, because the issue will certainly arise, especially since
>>> (AFAIU) Guile prefers UTF-8.
>>
>> Right.  (UTF-8 is just the default encoding for source code; it’s not
>> “preferred” in any other way.)
>
> The default conversion strategy here (for make-value) is to throw an exception.
> This isn't a port, and it doesn't feel right to use
> %default-port-conversion-strategy here.

Yes, but I mentioned it because scm_{fo,from}_locale_string use the
value of that fluid as their conversion strategy (info "(guile)
Conversion to/from C").

> It's easy enough to add #:encoding and #:errors options to make-value
> in a later patch.

Yes, that would be best.

(Actually, instead of keyword parameters, you could use optional
positional parameters like ‘string->bytevector’.)

>>>> >> +If the optional @var{length} argument is given, the string will be
>>>> >> +fetched and encoded to the length of characters specified.  If
>>>> >> +the @var{length} argument is not provided, the string will be fetched
>>>> >> +and encoded until a null of appropriate width is found.
>>>> >
>>>> > Isn't this null termination description skewed towards C-like
>>>> > languages?  Aren't there languages where strings don't have to be
>>>> > null-terminated?
>>>>
>>>> Yes, and that’s when LENGTH should be provided, AIUI.
>>>
>>> Then I guess the above should say that explicitly.  But it would be
>>> nice if GDB could support strings in languages that don't
>>> null-terminate even without LENGTH.
>>
>> Agreed (I had misread the description above as saying that, if LENGTH is
>> provided, then the string is *not* assumed to be nul-terminated.)
>
> I think the text that is there now is sufficient, I'm not sure how I
> would change it.
> I'm happy to apply any suggested rewordings.
>
> Note that as far as functionality goes, what's there now is what gdb provides.
> ref: LA_GET_STRING, struct language_defn.la_get_string.
> Any additional functionality can be added later.

If the functionality is that only null-terminated strings are supported,
then the text is fine.

Eli was suggesting supporting non-null-terminated strings as well, but
indeed, that can always be added later.

Thanks,
Ludo’.

  reply	other threads:[~2014-01-18 20:52 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-24 19:03 Doug Evans
2013-12-25 19:27 ` Eli Zaretskii
2014-01-03 21:31   ` Ludovic Courtès
2014-01-04  7:12     ` Eli Zaretskii
2014-01-04 11:57       ` Ludovic Courtès
2014-01-04 14:41         ` Eli Zaretskii
2014-01-04 17:42           ` Ludovic Courtès
2014-01-04 20:00             ` Eli Zaretskii
2014-01-16  4:20               ` Doug Evans
2014-01-18 20:36         ` Doug Evans
2014-01-18 20:52           ` Ludovic Courtès [this message]
2014-01-18 20:55             ` Doug Evans
2014-01-19 16:58               ` Eli Zaretskii
2014-01-19 17:19                 ` Doug Evans
2014-01-19 17:34                   ` Eli Zaretskii
2014-01-19 17:53                     ` Doug Evans
2014-01-19 18:10                       ` Eli Zaretskii
2014-01-19 21:19                         ` Doug Evans
2014-01-18 20:16     ` Doug Evans
2014-01-18 20:42       ` Ludovic Courtès
2014-01-18 21:57         ` Doug Evans
2014-01-19 14:46           ` Ludovic Courtès
2014-01-19 21:37             ` Doug Evans
2014-01-19 22:50               ` Ludovic Courtès
2014-01-18 22:32     ` Doug Evans
2014-01-19 14:47       ` Ludovic Courtès
2014-01-19 15:56         ` Eli Zaretskii
2014-01-19 16:13           ` Ludovic Courtès
2014-01-19 17:05             ` Doug Evans
2014-01-18 20:06   ` Doug Evans
2014-01-18 20:24     ` Eli Zaretskii
2014-01-18 20:53       ` Doug Evans
2014-01-19 16:57         ` Eli Zaretskii
2014-01-19 17:42           ` Doug Evans
2014-01-19 21:01           ` Doug Evans

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

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

  git send-email \
    --in-reply-to=87mwitovvh.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=xdje42@gmail.com \
    /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).