Re: If it looks like a bug and smells like a bug .....
"Paul Werkowski (as pw at snoopy dot qozzy dot com)" <[email protected]>
| Newsgroups | gmane.lisp.lispworks.general |
|---|---|
| Message-ID | <[email protected]> |
On 5/5/2025 10:29 AM, Michał "phoe" Herda (as phoe at disroot dot org) wrote: > In your example, TEST1 is calling SOME-FCN with keys :X and :Y, > neither of which is specified in SOME-FCN's lambda list, so an error > is signaled. This is exactly the case specified in CLHS 3.5.1.4 > Unrecognized Keyword Arguments. > > What exactly is the bug here? > > On 5.05.2025 16:21, Paul Werkowski (as pw at snoopy dot qozzy dot com) > wrote: >> From LispWorks CLIM 2.0 User Guide: >> >> invoke-with-output-to-output-record Generic Function >> >> (invoke-with-output-to-output-record >> stream continuation record-type &rest init-args &key) >> ...... >> continuation is a function of two arguments, the stream and the >> output record; it has dynamic extent. record-type is the type of >> output record to create. init-args are CLOS initialization arguments >> that are passed to make-instance when the new output record is created. >> >> CLTL page 76 deals with parsing lambda-lists. The &rest var is a list >> of everything else up to the ending #\). Keywords are not recognized >> as such until after the &key marker. >> >> Consider this example: >> >> (defclass record () >> ((s1 :initarg :x) >> (s2 :initarg :y))) >> >> (defun some-fcn (record-type &rest initargs &key foo) >> (print initargs) >> (apply 'make-instance record-type initargs)) >> >> (defun test1 () >> (some-fcn 'record :x 1 :y 2)) >> >> > (test1) >> Error: Unexpected keyword :X which is not one of (:FOO). >> 1 (continue) Ignore the unknown keyword :X. >> 2 (abort) Return to top loop level 0. >> >> This is exactly the form of error message generated by nested >> macros deep in the weeds of McCLIM table formatting code. >> >> This can be dealt with (sort of) by something like this: >> >> (defun test2 () >> (handler-bind ((conditions:unknown-keyword-error >> #'(lambda(c) >> (invoke-restart 'continue)))) >> (some-fcn 'record :x 1 :y 2))) >> >> > (test2) >> (:X 1 :Y 2) >> #<RECORD 401000C663> >> >> >> but not very useful in a large software system. >> >> Same issue with LWW 7.1. >> >> Should not be hard to fix this. Can DSPEC magic be used for a >> work-around? >> >> Paul >> >> >> >> >> _______________________________________________ >> Lisp Hug - the mailing list for LispWorks users >> [email protected] >> http://www.lispworks.com/support/lisp-hug.html > > _______________________________________________ > Lisp Hug - the mailing list for LispWorks users > [email protected] > http://www.lispworks.com/support/lisp-hug.html _______________________________________________ Lisp Hug - the mailing list for LispWorks users [email protected] http://www.lispworks.com/support/lisp-hug.html