This is the mail archive of the kawa@sourceware.org mailing list for the Kawa 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: Confusing error message


On 17/04/2011 08:04, Per Bothner wrote:


Type checking seems to be a mixed bag in Kawa, most of the time the type errors seem to emanate from a ClassCastException, which seems quite elegant. I'll have to look into why cdr doesn't do it like this, but when I find out why, would it be okay to try and make it use the ClassCastException as well?

I think so.

I had a look at this today, but the Kawa source got the better of me. For some stupid reason, I figured that the ClassCastException would be thrown with a custom detail string, how wrong I was.
For the contrived example of evaluating (cddr '()) [one that throws ClassCastExceptions currently] the exception is thrown from ModuleMethod.apply1 in the expression,


return module.apply1(this, arg1);

I was looking at this in a debugger and noticed that module is of type "lists" which from a quick inspection doesn't have an apply1 method (it's a scheme file), I'm struggling to understand how this is working at all! The stack trace suggests the error really came from the following in lists.scm,

(define-procedure cdr
  setter: set-cdr!
  (lambda (x :: <pair>) name: 'cdr
      x:cdr))

I suppose from the x :: <pair>, since at this point, x is a list. I can't figure out where to catch this exception before it gets parcelled up. I could regex out the types in from Throwable.getMessage() and then look them up, but this seems excessively kludgey.

I'm sorry I'm making such a pigs ear of this seemingly simple change!

Thanks for reading,

Charles.


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