This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v1 02/36] Guile extension language: doc additions
- From: ludo at gnu dot org (Ludovic CourtÃs)
- To: Doug Evans <xdje42 at gmail dot com>
- Cc: Eli Zaretskii <eliz at gnu dot org>, "gdb-patches\ at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Sun, 19 Jan 2014 15:46:43 +0100
- Subject: Re: [PATCH v1 02/36] Guile extension language: doc additions
- Authentication-results: sourceware.org; auth=none
- References: <52b9da59 dot 64ab440a dot 0b0b dot 7e1c at mx dot google dot com> <83ha9w68av dot fsf at gnu dot org> <87sit4kb1t dot fsf at gnu dot org> <CAP9bCMQaFQaYJKTR0mc6Gf3BU310QuNH5eL+er_KOAre=U+9Kg at mail dot gmail dot com> <8761phqaws dot fsf at gnu dot org> <CAP9bCMSO5mdjCEFsrpKq4nZFaaqadeWT-MOWU2ZfL5z0cL2ogg at mail dot gmail dot com>
Doug Evans <xdje42@gmail.com> skribis:
> On Sat, Jan 18, 2014 at 12:42 PM, Ludovic CourtÃs <ludo@gnu.org> wrote:
>> Doug Evans <xdje42@gmail.com> skribis:
>>
>>> On Fri, Jan 3, 2014 at 1:30 PM, Ludovic CourtÃs <ludo@gnu.org> wrote:
>>>>>> +The optional @var{errors} argument is either @code{"strict"}
>>>>>> +or @code{"replace"}. A value of @code{"strict"} corresponds to
>>>>>> +Guile's @code{SCM_FAILED_CONVERSION_ERROR} and a value of @code{"replace"}
>>>>>> +corresponds to Guile's @code{SCM_FAILED_CONVERSION_QUESTION_MARK}.
>>>>>
>>>>> Suggest a cross-reference to Guile documentation here.
>>>>
>>>> Agreed. Also, Guile talks of âconversion strategyâ and âconversion
>>>> error handlerâ, with values âerrorâ, âsubstituteâ, and âescapeâ (at the
>>>> Scheme level), and Iâd recommend sticking to those names and terminology.
>>>
>>> The values chosen were to be consistent with the python support.
>>> OTOH I *do* like being more consistent with the particular extension
>>> language at hand.
>>> I've tentatively changes things to use "error" and "substitute".
>>> Question: How about exporting the SCM_FAILED_CONVERSION_* constants
>>> and using those instead?
>>>
>>> E.g, (value->string foo #:errors SCM_FAILED_CONVERSION_ERROR) ?
>>
>> Iâd rather use a symbol:
>
> Yeah, I thought of that, but the encoding is a string,
> so it'd be "#:encoding string #:errors symbol".
Right. Looks good to me.
> I don't have a strong preference, but using a symbol here while
> feeling Schemey feels too weird.
> It's not a strong preference though.
Using a symbol for #:errors? It would be natural and consistent with
the rest of Guileâs API (notably and âstring->bytevectorâ,
âset-port-conversion-strategy!â.)
>> (value->string foo #:conversion-strategy 'error)
>>
>> So that has to be converted in C but I think thatâs OK.
>
> #:conversion-strategy is more to type than #:errors but I'm happy to
> change it if you want.
> Though this is a case where I would not want to support both
> #:conversion-strategy and #:errors so whatever we pick is it.
Right. Or âvalue->stringâ could have this signature:
value->string VAL [ENCODING [ERRORS]]
The precedent being âstring->pointerâ and âstring->bytevectorâ.
> We can create a 'error symbol at start up and just use scm_eq so the
> comparison is easy enough.
Exactly, thatâs what I would suggest.
Thanks,
Ludoâ.