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] |
> ERROR: In procedure apply in expression (add-obs (obs # # ...)): > ERROR: Wrong type argument in position 1: %S > ABORT: (wrong-type-arg) > > I'm not even sure what it means. I tracked this down once before, don't think I reported it... OK, the %S is a substitution parameter for the argument value which is expanded in scm_display_error_message() much in the wonderful way that printf() expands % escapes. Now the argument that should be expanded once went through scm_error() which constructed a list using scm_listify(). 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. If every instance of scm_listify() was replaced with a nested set of scm_cons() calls, the result would be code that is more difficult to read but runs much better. I'd say that error handling code should use the most utterly base calls that still get the job done, if there's one area that you want rock solid it is the error handler. On this note, current guile error handling is horribly complicated, contorted, could be much simpler, should be much simpler (have I said it enough?) but at least it works (mostly). Well, at least now everyone knows what the above message means. I have no explanation as to what you were doing that generated a SCM_UNDEFINED in the first place though :-( - Tel