• Re: condition restarts : restart-case with :test typep not visible in many lisps

    From Jason Cornez@jcornez@dev268-k.mail-host-address-is-not-set to comp.lang.lisp on Mon Jun 29 09:17:09 2026
    From Newsgroup: comp.lang.lisp

    Hi Madhu,

    I don't think I have an answer to your question, but I can report what
    ACL11 does.
    ```
    CL-USER(09:12:12): (define-condition my-error (error) ())
    (defun my-error-p (thing) (typep thing 'my-error))
    (assert (my-error-p (make-condition 'my-error)))
    (defun test ()
    (block nil
    (restart-case (error 'my-error)
    (ignore-my-error ()
    :report "Ignore My error"
    :test my-error-p
    (return 'ok)))))

    (test)

    MY-ERROR
    CL-USER(09:12:16): MY-ERROR-P
    CL-USER(09:12:16): NIL
    CL-USER(09:12:16): TEST
    CL-USER(09:12:16): CL-USER(09:12:16): [2026-06-29 09:12:16]
    Error: #<MY-ERROR @ #x1056e16e072>
    [condition type: MY-ERROR]

    Restart actions (select using :continue):
    0: Return to Top Level (an "abort" restart).
    1: Abort entirely from this (lisp) process.
    [1] CL-USER(09:12:16): :cont 0
    CL-USER(09:12:41):
    ```
    I also confirm the same behavior when the code is in a file and compiled
    before running (test)

    -Jason
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Madhu@enometh@meer.net to comp.lang.lisp on Wed Jul 1 14:19:46 2026
    From Newsgroup: comp.lang.lisp

    * Jason Cornez <87pl19olxm.fsf@dev268-k.mail-host-address-is-not-set> :
    Wrote on Mon, 29 Jun 2026 09:17:09 +0200:
    I don't think I have an answer to your question, but I can report what
    ACL11 does.
    ```
    CL-USER(09:12:12): (define-condition my-error (error) ())
    (defun my-error-p (thing) (typep thing 'my-error))
    (assert (my-error-p (make-condition 'my-error)))
    (defun test ()
    (block nil
    (restart-case (error 'my-error)
    (ignore-my-error ()
    :report "Ignore My error"
    :test my-error-p
    (return 'ok)))))

    (test)

    MY-ERROR
    CL-USER(09:12:16): MY-ERROR-P
    CL-USER(09:12:16): NIL
    CL-USER(09:12:16): TEST
    CL-USER(09:12:16): CL-USER(09:12:16): [2026-06-29 09:12:16]
    Error: #<MY-ERROR @ #x1056e16e072>
    [condition type: MY-ERROR]

    Restart actions (select using :continue):
    0: Return to Top Level (an "abort" restart).
    1: Abort entirely from this (lisp) process.
    [1] CL-USER(09:12:16): :cont 0
    CL-USER(09:12:41):
    ```
    I also confirm the same behavior when the code is in a file and compiled
    before running (test)

    Thanks, yes acl's repl decides the restart isn't visible, and avoids the
    issue. But when running through sly or slime's debuggers, the ignore-my-restart is visible, but when you try to invoke it one gets a
    "restart is not active", like in the other lisps.

    This is a problem when this pattern (of declaring type visibility) is
    used the wild (e.g. with iolib: src/sockets/socket-methods.lisp, where
    the retry-syscall restart is meant to be invoked (say on EAGAIN), but is
    not visible, or if visible, cannot be successfully invoked.)

    [I thought I had a different memory from acl81_express from 2007-2009, I
    didn't have the distribution tar.bz2 but had a backup of an installed
    directory from around then and tried spinning it up under a faketime'd
    qemu with a 32bit system from that time, but i couldn't get past the
    license checks. (in general allegro express licenses expire too
    quickly)
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Kaz Kylheku@046-301-5902@kylheku.com to comp.lang.lisp on Tue Jul 7 18:39:34 2026
    From Newsgroup: comp.lang.lisp

    On 2026-06-29, Jason Cornez <jcornez@dev268-k.mail-host-address-is-not-set> wrote:
    Hi Madhu,

    I don't think I have an answer to your question, but I can report what
    ACL11 does.
    ```
    CL-USER(09:12:12): (define-condition my-error (error) ())
    (defun my-error-p (thing) (typep thing 'my-error))
    (assert (my-error-p (make-condition 'my-error)))
    (defun test ()
    (block nil
    (restart-case (error 'my-error)
    (ignore-my-error ()
    :report "Ignore My error"
    :test my-error-p
    (return 'ok)))))

    (test)

    MY-ERROR
    CL-USER(09:12:16): MY-ERROR-P
    CL-USER(09:12:16): NIL
    CL-USER(09:12:16): TEST
    CL-USER(09:12:16): CL-USER(09:12:16): [2026-06-29 09:12:16]
    Error: #<MY-ERROR @ #x1056e16e072>
    [condition type: MY-ERROR]

    Restart actions (select using :continue):
    0: Return to Top Level (an "abort" restart).
    1: Abort entirely from this (lisp) process.
    [1] CL-USER(09:12:16): :cont 0
    CL-USER(09:12:41):
    ```
    I also confirm the same behavior when the code is in a file and compiled
    before running (test)

    CLISP (old Ubuntu build: GNU CLISP 2.49.60+ (2017-06-25))

    (define-condition my-error (error) ())
    MY-ERROR
    (defun my-error-p (thing) (typep thing 'my-error))
    MY-ERROR-P
    (assert (my-error-p (make-condition 'my-error)))
    NIL
    (defun test ()
    (block nil
    (restart-case (error 'my-error)
    (ignore-my-error ()
    :report "Ignore My error"
    :test my-error-p
    (return 'ok)))))
    TEST
    (test)

    *** - Condition of type MY-ERROR.
    The following restarts are available:
    IGNORE-MY-ERROR :R1 Ignore My error
    ABORT :R2 Abort main loop

    Non-interactive test terminates:

    $ clisp restart-case.lisp
    *** - Condition of type MY-ERROR.
    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Madhu@enometh@meer.net to comp.lang.lisp on Wed Jul 8 15:18:05 2026
    From Newsgroup: comp.lang.lisp

    * Kaz Kylheku <20260707113059.931@kylheku.com> :
    Wrote on Tue, 7 Jul 2026 18:39:34 -0000 (UTC):

    [...]
    TEST
    (test)

    *** - Condition of type MY-ERROR.
    The following restarts are available:
    IGNORE-MY-ERROR :R1 Ignore My error
    ABORT :R2 Abort main loop

    Non-interactive test terminates:

    $ clisp restart-case.lisp
    *** - Condition of type MY-ERROR.

    Now try invoking the restart "Ignore My error"

    I'm sure clisp also throws "no restart found" when the restart is
    invoked.
    --- Synchronet 3.22a-Linux NewsLink 1.2