Prev: finalize-inheritance: how to control the invocation timing
Next: trace of NANO THERMITE in WTC dust -- and almost no asbestos, because the scare stopped it from being used (and the buildings might not have collapsed, if it was)
From: Andrew Myers on 22 Jul 2010 15:25 On Jul 22, 2:51 pm, Madhu <enom...(a)meer.net> wrote: > * Andrew Myers Wrote on Thu, 22 Jul 2010 11:00:54 -0700 (PDT): > | Thanks for the quick answer, I just installed SBCL on my work machine > | and it works there too. Looks like a problem with Allegro CL and I > | have an email in to their support asking about it. Thanks for the > | data point! Andrew > > The issue is not so clear, given your intent. > > See the thread starting at > <http://news.gmane.org/group/gmane.lisp.openmcl.devel/thread=5944/> > > And my suggestion there > -- > Madhu Thanks for the link Madhu, we had considered your suggestion of using a global to get around this but didn't like it. My provided code is may not be clear because my intent was simply to show that nil was being passed in all the time. Here is some code that is a bit more straightforward and demonstrates the problem: (define-condition my-error (error) ((my-message :accessor my-message :initform "my thrown error."))) (defun maybe-signal-my-error (x) (restart-case (if ( = x 1) (error 'my-error) (error "Normal error.")) (continue (c) :test (lambda (condition) (format t "Condition type is:~a~%" (type-of condition)) (typep condition 'my-error)) (format t "Caught condition of type ~a~%" (type-of c))))) If you call maybe-signal-my-error in Allegro CL you will _always_ see "Condition type is:NULL", in SBCL you will see the appropriate "SIMPLE- ERROR" or "MY-ERROR". The problem doesn't really have anything to do with which restarts are invoked/available. I would be happy if the restarts were not presented at the REPL when the error was not of type my-error. Andrew
From: Madhu on 22 Jul 2010 16:47 * Andrew Myers Wrote on Thu, 22 Jul 2010 12:25:13 -0700 (PDT): | On Jul 22, 2:51 pm, Madhu <enom...(a)meer.net> wrote: |> * Andrew Myers Wrote on Thu, 22 Jul 2010 11:00:54 -0700 (PDT): |> | Thanks for the quick answer, I just installed SBCL on my work machine |> | and it works there too. Looks like a problem with Allegro CL and I |> | have an email in to their support asking about it. Thanks for the |> | data point! Andrew |> |> The issue is not so clear, given your intent. |> |> See the thread starting at |> <http://news.gmane.org/group/gmane.lisp.openmcl.devel/thread=5944/> |> |> And my suggestion there |> -- |> Madhu | | Thanks for the link Madhu, we had considered your suggestion of using | a global to get around this but didn't like it. My provided code is | may not be clear because my intent was simply to show that nil was | being passed in all the time. Here is some code that is a bit more | straightforward and demonstrates the problem: | | (define-condition my-error (error) | ((my-message :accessor my-message :initform "my thrown error."))) | | (defun maybe-signal-my-error (x) | (restart-case | (if ( = x 1) (error 'my-error) (error "Normal error.")) | (continue (c) :test (lambda (condition) (format t "Condition type ^^^^^^^^^^^^^^^^[1] | is:~a~%" (type-of condition)) | (typep condition 'my-error)) | (format t "Caught condition of type ~a~%" (type-of c))))) | | If you call maybe-signal-my-error in Allegro CL you will _always_ see | "Condition type is:NULL", in SBCL you will see the appropriate | "SIMPLE- ERROR" or "MY-ERROR". The problem doesn't really have | anything to do with which restarts are invoked/available. Well the TEST determines which restarts are active | I would be happy if the restarts were not presented at the REPL when | the error was not of type my-error. And only active restarts are shown in the REPL. My point was that even if ACL were fixed and behaved as you wished, and the error in your test code[1] was fixed, you would still have a problem when attempting to invoke the restart which had the TYPEP active-test in the TEST clause. I do not believe you can get away from the problem described in the ccl thread. [1] In your RESTART-CASE code you use an argument `c' to the condition restart clause. Note that Each arglist is an ordinary lambda list to be bound during the execution of its corresponding forms. These parameters are used by the restart-case clause to receive any necessary data from a call to invoke-restart. IOW The `c' parameter is what gets passed to your code via an INVOKE-RESTART (say from an :interactive spec) and is NOT the condition as your FORMAT code appears to expect. Note the syntax of RESTART-CASE differs from that of HANDLER-CASE. -- Madhu
From: Madhu on 22 Jul 2010 16:57 * Madhu <m3bp9zs0oy.fsf(a)linux-tbcs.site> : Wrote on Fri, 23 Jul 2010 02:17:57 +0530: | | "SIMPLE- ERROR" or "MY-ERROR". The problem doesn't really have | | anything to do with which restarts are invoked/available. | | Well the TEST determines which restarts are active I was not being precise. It determines which [active] restarts are visible | | I would be happy if the restarts were not presented at the REPL when | | the error was not of type my-error. | | And only active restarts are shown in the REPL. And only "active/visible" restarts are shown in the REPL.
From: Andrew Myers on 23 Jul 2010 07:48
On Jul 22, 4:47 pm, Madhu <enom...(a)meer.net> wrote: > * Andrew Myers Wrote on Thu, 22 Jul 2010 12:25:13 -0700 (PDT): > > | On Jul 22, 2:51 pm, Madhu <enom...(a)meer.net> wrote: > |> * Andrew Myers Wrote on Thu, 22 Jul 2010 11:00:54 -0700 (PDT): > |> | Thanks for the quick answer, I just installed SBCL on my work machine > |> | and it works there too. Looks like a problem with Allegro CL and I > |> | have an email in to their support asking about it. Thanks for the > |> | data point! Andrew > |> > |> The issue is not so clear, given your intent. > |> > |> See the thread starting at > |> <http://news.gmane.org/group/gmane.lisp.openmcl.devel/thread=5944/> > |> > |> And my suggestion there > |> -- > |> Madhu > | > | Thanks for the link Madhu, we had considered your suggestion of using > | a global to get around this but didn't like it. My provided code is > | may not be clear because my intent was simply to show that nil was > | being passed in all the time. Here is some code that is a bit more > | straightforward and demonstrates the problem: > | > | (define-condition my-error (error) > | ((my-message :accessor my-message :initform "my thrown error."))) > | > | (defun maybe-signal-my-error (x) > | (restart-case > | (if ( = x 1) (error 'my-error) (error "Normal error.")) > | (continue (c) :test (lambda (condition) (format t "Condition type > > ^^^^^^^^^^^^^^^^[1] > > | is:~a~%" (type-of condition)) > | (typep condition 'my-error)) > | (format t "Caught condition of type ~a~%" (type-of c))))) > | > | If you call maybe-signal-my-error in Allegro CL you will _always_ see > | "Condition type is:NULL", in SBCL you will see the appropriate > | "SIMPLE- ERROR" or "MY-ERROR". The problem doesn't really have > | anything to do with which restarts are invoked/available. > > Well the TEST determines which restarts are active > > | I would be happy if the restarts were not presented at the REPL when > | the error was not of type my-error. > > And only active restarts are shown in the REPL. > > My point was that even if ACL were fixed and behaved as you wished, and > the error in your test code[1] was fixed, you would still have a problem > when attempting to invoke the restart which had the TYPEP active-test in > the TEST clause. I do not believe you can get away from the problem > described in the ccl thread. > > [1] In your RESTART-CASE code you use an argument `c' to the condition > restart clause. Note that > > Each arglist is an ordinary lambda list to be bound during the > execution of its corresponding forms. These parameters are used by > the restart-case clause to receive any necessary data from a call > to invoke-restart. > > IOW The `c' parameter is what gets passed to your code via an > INVOKE-RESTART (say from an :interactive spec) and is NOT the condition > as your FORMAT code appears to expect. Note the syntax of RESTART-CASE > differs from that of HANDLER-CASE. > > -- > Madhu Madhu, Unfortunately I posted code which is the result of debugging for a while and pairing down what I'm actually trying to run so I was passing the condition back to the restart at one point. | My point was that even if ACL were fixed and behaved as you wished, and | the error in your test code[1] was fixed, you would still have a problem | when attempting to invoke the restart which had the TYPEP active- test in | the TEST clause. I do not believe you can get away from the problem | described in the ccl thread. Perhaps I read the thread wrong, I was under the impression that the problem in the thread was that if you invoked restarts by name specifically without using find-restart you would be allowed to invoke restarts which weren't really applicable to the current condition. e.g. If I have an error type condition being thrown out of a restart case which has restarts that are only applicable to my-error conditions I can't prevent someone from calling (invoke-restart 'my- continuation) even though that is not applicable to error type conditions. I'm not too worried about this scenario right now because all this code should only be used in house. Is there another point that I missed from the thread you posted? Thanks, Andrew |