This is the mail archive of the guile@cygnus.com mailing list for the guile project.


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

Re: Wrong type argument in position 1: %S



> Interesting little function scm_listify()... it uses the C
> varargs to be able to handle any number of arguments, knowing that
> the list is ended when it sees SCM_UNDEFINED. Unfortunately,
> there are some error situations where you accidently end up with
> a SCM_UNDEFINED value and it usually fails type-checking somewhere
> resulting in a (quote wrong-type-arg) being thrown, the SCM_UNDEFINED
> is passed as your faulty argument value to scm_listify() which creates
> a much shorter list of args than was expected and scm_display_error_message()
> gets this short list, figures that it better do something so it displays
> the %S.

Right... I see what's going on.  SCM_UNDEFINED effectively truncates
the argument list.

The thing is, code should never be trying to print SCM_UNDEFINED in
the first place.  It's not a valid Scheme value.  The error should be
caught and reported earlier.