Re: (format ... "~A" (apply #'format nil errorstring arguments))

Bruno Haible <[email protected]>
Newsgroups gmane.lisp.clisp.devel
Message-ID <2613506.B8zBZXOocA@omega>
Sam wrote on 2017-08-02:
> In clos-method2.lisp and many other places you have this pattern:
> 
> --8<---------------cut here---------------start------------->8---
> (defmacro program-error-reporter (caller)
>   `#'(lambda (form detail errorstring &rest arguments)
>        (apply #'sys::lambda-list-error form detail
>               "~S: ~A" ,caller (apply #'format nil errorstring arguments))))
> --8<---------------cut here---------------end--------------->8---
> 
> Why not
> 
> --8<---------------cut here---------------start------------->8---
> (defmacro program-error-reporter (caller)
>   `#'(lambda (form detail errorstring &rest arguments)
>        (apply #'sys::lambda-list-error form detail
>               "~S: ~?" ,caller errorstring arguments)))
> --8<---------------cut here---------------end--------------->8---
> 
> The only place where the second pattern is used is invalid-method-error
> and method-combination-error in close-methcomb2.

I replied:
> Both are equivalent.

Not always. When the format string contains directives that are sensitive
on the current column position (tabulate, justification, all pretty-printing
directives) or newline state (fresh-line, elastic-newline), the two idioms
may produce different results.

I don't know whether this has an impact on your change from 2017-08-02.

Bruno


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
clisp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.