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

Sam Steingold <[email protected]>
Newsgroups gmane.lisp.clisp.devel
Message-ID <[email protected]>
> * Bruno Haible <[email protected]> [2017-08-23 22:09:17 +0200]:
>
> 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.

Valid point, and, I think, an excellent argument in favor of the second
version.

Thanks

-- 
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1504
http://steingoldpsychology.com http://www.childpsy.net
http://honestreporting.com http://mideasttruth.com
MS DOS: Keyboard not found. Press F1 to continue.

------------------------------------------------------------------------------
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.