Subject: [clisp-list] CLISP and define-condition

From: "David E. Young" <[email-masked]>
Date: Tue, 3 Apr 2001 14:29:23 -0400

Greetings. I'm having a problem getting CLISP to accept a
define-condition form that three other mainstream Lisps recognize just
fine.

Given the following:

(define-condition syntactical-error (lisa-error)
  ((element :initarg :element
            :initform nil
            :reader syntactical-error-element))
  (:report
   (lambda (condition strm)
     (let ((element (syntactical-error-element condition)))
       (if (null element)
           (format strm "Syntax error:~%")
         (format strm "While evaluating the element ~S:~%" element))
       (format strm (lisa-error-text condition))))
   :documentation
   "This condition represents syntactical errors discovered during the initial
   parsing pass."))

CLISP complains:

Compiling file /opt/files/devel/sourceforge/lisa/src/engine/conditions.lisp ...
*** - DEFINE-CONDITION SYNTACTICAL-ERROR: invalid syntax in DEFINE-CONDITION option: 
(:REPORT
 (LAMBDA (CONDITION STRM)
  (LET ((ELEMENT (SYNTACTICAL-ERROR-ELEMENT CONDITION)))
   (IF (NULL ELEMENT) (FORMAT STRM "Syntax error:~%")
    (FORMAT STRM "While evaluating the element ~S:~%" ELEMENT))
   (FORMAT STRM (LISA-ERROR-TEXT CONDITION))))
 :DOCUMENTATION
 "This condition represents syntactical errors discovered during the initial
   parsing pass.")
1. Break LISA[4]>

I'm running CLISP 2.25 in full ANSI (clisp -a) on RedHat 6.2.

Regards,

-- 
-----------------------------------------------------------------
David E. Young
Fujitsu Network Communications  (defun real-language? (lang)
([email-masked])           (eq lang 'LISP))

"But all the world understands my language."
  -- Franz Joseph Haydn (1732-1809)

---

From: Sam Steingold <[email-masked]>
Date: 03 Apr 2001 13:50:39 -0500

> * In message <[email-masked]>
> * On the subject of "[clisp-list] CLISP and define-condition"
> * Sent on Tue, 3 Apr 2001 14:29:23 -0400
> * Honorable "David E. Young" <[email-masked]> writes:
>

your parentheses are placed incorrectly:
correct:

(define-condition syntactical-error (...)
  (...)
  (:report ...)
  (:documentation ...))

you have:

(define-condition syntactical-error (...)
  (...)
  (:report ...
   :documentation ...))

please see CLHS.

-- 
Sam Steingold (http://www.podval.org/~sds)
Support Israel's right to defend herself! <http://www.i-charity.com/go/israel>
Read what the Arab leaders say to their people on <http://www.memri.org/>
char*a="char*a=%c%s%c;main(){printf(a,34,a,34);}";main(){printf(a,34,a,34);}