Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Right-click on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Peter Graves <peter@ar...> - 2005-10-30 13:31:52
|
On Sun, 30 Oct 2005 at 13:40:05 +0100, Andras Simon wrote: > There are a few things that I don't understand about this. Why don't > conditions that are subclasses of JAVA-EXCEPTION inherit the cause > slot? They do: CL-USER(1): (define-condition throwable (java-exception) ()) THROWABLE CL-USER(2): (signal 'throwable) Debugger invoked on condition of type THROWABLE: #<THROWABLE {374956}> Restarts: 0: TOP-LEVEL Return to top level. [1] CL-USER(3): (inspect *debug-condition*) 0 LAYOUT -----------> #<SYSTEM:LAYOUT {1FC1B56}> 1 CAUSE ------------> #<UNBOUND> 2 FORMAT-CONTROL ---> #<UNBOUND> 3 FORMAT-ARGUMENTS -> #<UNBOUND> [2i] CL-USER(4): > And where does the message disappear? It is passed to signal, as > in > > signal(condition, new SimpleString(getMessage(t))) Yes, but that just passes the message to the real SIGNAL, defined in signal.lisp: public static final LispObject signal(LispObject condition, LispObject message) throws ConditionThrowable { return Symbol.SIGNAL.execute(condition, Keyword.MESSAGE, message); } I don't think the :message keyword is used anywhere else, so this doesn't make much sense, and that signal() function should go away. The underlying problem is that conditions don't have a MESSAGE slot. The Java class Condition has a message field: protected String message = null; But that's very old, and dates back to a time when ABCL's conditions weren't CLOS objects. That field should probably go away too, but there are vestiges of it in a number of places. The right way to do things nowadays is to use the FORMAT-CONTROL slot (via the :format-control initarg), which all instances of subclasses of CONDITION have. That said, there's clearly a bug in this area: CL-USER(21): (define-condition test-error (program-error) ()) TEST-ERROR CL-USER(23): (error 'test-error :format-control "this is a test") Debugger invoked on condition of type TEST-ERROR: Debugger invoked on condition of type TYPE-ERROR: The value #<UNBOUND> is not of type LIST. Restarts: 0: TOP-LEVEL Return to top level. I'll try to fix that later today. > Is any of this related to my messing with exceptions? I don't think so, since the problem occurs with conditions derived from PROGRAM-ERROR too. > Ideally, what I think should happen is that any condition that is a > subtype of JAVA-EXCEPTION has a CAUSE and a MESSAGE slot (with readers > and all), and they get filled in when the condition is signaled. The CAUSE slot should be there, and JAVA:JAVA-EXCEPTION-CAUSE is the reader for it. As mentioned, there is no MESSAGE slot. > How could I arrange this? I'll let you know after I figure out what the bug is. Stay tuned... :) -Peter |