[Ecls-list] Strange non-catching of error

David Creelman creelman.david at gmail.com
Fri Jun 6 08:19:58 UTC 2008


Hi,

I'm writing a utility to generate scripts for a small scripting language that I
use a fair bit.

I'm using a macro to wrap up a bunch of statement creation commands and I need
to insert end of lines into the output file.

Below is the slightly error prone version that I wrote that didn't generate
an error in ECL, but did in SBCL.

(defmacro with-script (name &rest args)
  (let ((script-return (gensym)))
    `(let ((,script-return ""))
       (setf ,script-return (out (combine script-token (quoted ,name) '(\#newline)) ; Error is here...
				 (with-indent , at args) '(#\newline)
				 (outln (gen-end script-token))))
       ,script-return))) 

The problem is that ECL in theory shouldn't know how to print \#newline (I meant
to type #\newline). I got a different character (sometimes non printable) each
time I ran my test script over it, but it didn't complain.

I wondered if SBCL might tell me more, so I tried it and it complained with 

debugger invoked on a TYPE-ERROR in thread #<THREAD "initial thread" {A8846F9}>:
  The value |#NEWLINE| is not of type CHARACTER.

This was quite useful. It found my typo. Would it be possible to get ECL to 
behave in a similar way to this?

Cheers
DC

PS please feel free to fling criticisms upon my macro.





More information about the ecl-devel mailing list