guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: scm_out_of_range_pos()


From: Dirk Herrmann
Subject: Re: scm_out_of_range_pos()
Date: Sun, 2 Sep 2001 11:59:40 +0200 (MEST)

On 1 Sep 2001, Martin Baulig wrote:

> is there any reason why there's both scm_out_of_range() and
> scm_out_of_range_pos() instead of checking whether pos != 0 like
> in scm_wrong_type_arg() ?

The question could as well go the other way around:  Why is 0 a magic
number, that indicates an unknown parameter position?  IMO, in a lot of
places where there is made use of the 0=unknown trick, proper argument
numbers could be given.  A typical example are those functions, which take
a rest argument and simply don't bother to count which argument they are
currently checking.  In these functions, an argument position of 0 is
given.  This is not very user friendly.

The first attempt should be made at removing most of those places where a
0 parameter is given.  Second, we should revise the set of error
signalling functions to be more consistent.

> The behavior of the VALIDATE macros is currently inconsistent if
> you pass pos == 0 - most of them (which are using SCM_ASSERT) print
> the correct error message - and the ones which are using SCM_ASSERT_RANGE
> print "... argument 0 ..." in the error message.

As an _intermediate_ solution, we should try to handle that special case
to avoid such bogus messages.

Best regards,
Dirk Herrmann




reply via email to

[Prev in Thread] Current Thread [Next in Thread]