[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Accessing multiple values from C
From: |
Ludovic Courtès |
Subject: |
Re: Accessing multiple values from C |
Date: |
Wed, 18 Jan 2012 22:44:39 +0100 |
User-agent: |
Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.90 (gnu/linux) |
Hi!
Mark H Weaver <address@hidden> skribis:
> address@hidden (Ludovic Courtès) writes:
>
>> Mark H Weaver <address@hidden> skribis:
>>
>>> Julian Graham <address@hidden> writes:
>>>> +SCM
>>>> +scm_c_value_ref (SCM obj, size_t idx)
>>>> +{
>>>> + SCM values = scm_struct_ref (obj, SCM_INUM0);
>>>> + return scm_list_ref (values, SCM_I_MAKINUM (idx));
>>>> +}
>>>> +
>>>
>>> Should this verify that `obj' is a values object?
>>>
>>> Should it verify that `idx' can fit in an inum?
>>
>> Yes, good point. Using an ‘SCM_VALIDATE’, which will throw an exception
>> upon error, right?
>
> Well, there's a complication with using an `SCM_VALIDATE' to check for
> values objects. If `idx' is 0 (make sure it's exact!), then we must
> _not_ throw an exception if `obj' is not a values object. However, in
> that case we still need to know whether `obj' is a values object or not.
Yes, I already agreed on this one. ;-)
> Also, a fine point about desirable error messages: asking for `idx' 5 of
> a values object with only 3 elements is, conceptually, the same kind of
> error as asking for `idx' 5 of something that is _not_ a values object.
>
> Therefore, I think in both cases the error should be something to the
> effect of "too few values".
Right.
Ludo’.
- Re: Accessing multiple values from C, Andy Wingo, 2012/01/09
- Re: Accessing multiple values from C, Julian Graham, 2012/01/09
- Re: Accessing multiple values from C, Julian Graham, 2012/01/11
- Re: Accessing multiple values from C, Mark H Weaver, 2012/01/17
- Re: Accessing multiple values from C, Andy Wingo, 2012/01/18
- Re: Accessing multiple values from C, Ludovic Courtès, 2012/01/18
- Re: Accessing multiple values from C, Julian Graham, 2012/01/18
- Re: Accessing multiple values from C, Mark H Weaver, 2012/01/18
- Re: Accessing multiple values from C,
Ludovic Courtès <=
- Re: Accessing multiple values from C, Mark H Weaver, 2012/01/18
- Re: Accessing multiple values from C, Mark H Weaver, 2012/01/18