This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v1 02/36] Guile extension language: doc additions


On Sun, Jan 19, 2014 at 6:46 AM, Ludovic Courtès <ludo@gnu.org> wrote:
> 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!’.)

"works for me"

Though I see %default-port-conversion-strategy is used by more than
just ports, so it seems reasonable for gdb to use that as the default
too (obtainable by calling scm_port_conversion_strategy (SCM_BOOL_F)).

>>>   (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’.

I'd like to stick with the current signature.

>> 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.

Righto.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]