From: Sam S. <sd...@gn...> - 2017-08-02 22:47:19
|
Bruno, 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. Thanks. -- Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1504 http://steingoldpsychology.com http://www.childpsy.net http://think-israel.org http://no2bds.org http://jij.org http://honestreporting.com You won't get smarter by calling me a fool. |
From: Bruno H. <br...@cl...> - 2017-08-03 01:37:13
|
Hi Sam, > 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--- Both are equivalent. I find the first one easier to understand, because ~S, ~A, and APPLY are very familiar to everyone, whereas I wouldn't remember how ~? works exactly - there are two cases - without looking up CLHS 22.3.7.6. The other possible explanation is that FORMATTER of ~? was not completely implemented when I wrote clos-method2.lisp, and I dared to use ~? only after it was efficient enough. Bruno |
From: Bruno H. <br...@cl...> - 2017-08-23 20:09:28
|
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 |
From: Sam S. <sd...@gn...> - 2017-08-23 20:37:21
|
> * Bruno Haible <oe...@py...t> [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. |