[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What does the standard say about CERROR?



>I'm a little confused about the behavior of MCL 2.0p2 with the function
>CERROR.  Following is some example code that seems like it should work, but
>doesn't.
>
>(defparameter *cerror* (make-condition 'simple-error
>                       :format-string "FIle 1 (~a) shorter than file 2 (~a)"
>                        :format-arguments '(foo bar)))
>;; *cerror* is now #<simple-error #xD14041>
>
>
>(simple-condition-format-arguments *cerror*)
>;; sanity check.  this call returns the correct thing: (Foo Bar).  So the
>condition is OK
>
>
>;; CLTL2, on page 887, says that cerror takes a continue-format-string
>;; a datum (which can be simply a condition, as in this case), &rest arguments
>;; which are used (when the datum is a condition) in the continue-format-string
>;; this description matches the arglist in the fred minibuffer, BTW
>
>
>;; but
>(cerror  "Truncate file 2 (~a)"  *cerror* 'bar)
>;; returns 
>;;> Error: Too many arguments.
>;;> While executing: CCL::CONDITION-ARG
>;;> Type Command-/ to continue, Command-. to abort.
>;;> If continued: Truncate file 2 (BAR)
>;;See the Restartsn menu item for further choices.
>;;1 > 
>;; notice that the continue string is correct

This is indeed a bug in MCL 2.0. I have prepared a patch for inclusion
in patch 3. If you want it before then, ask for "cerror-patch".

>;; the syntax presented on CLTL2, page 667, which was overridden by
>;; the 887 syntax, says that cerror takes a continue-format-string,
>;; an error-format-string, &rest arguments (as in the following)
>
>(cerror "Truncate file 2" "File 1 (~a) shorter than file 2 (~a)" 'foo 'bar)
>
>
>;; this (incorrect?) call works
>;;> Error: File 1 (FOO) shorter than file 2 (BAR)
>;;> While executing: CCL::TOPLEVEL-EVAL
>;;> Type Command-/ to continue, Command-. to abort.
>;;> If continued: Truncate file 2
>;;See the Restartsn menu item for further choices.
>;;1 > 
>
>Does this contradict the standard?  Or has there been some change?

CERROR also accepts a string as the second arg. This is documented
on p. 887. Hence, your second example is correct and MCL handles it
correctly.

-----
Bill St. Clair
bill@cambridge.apple.com