Re: If it looks like a bug and smells like a bug .....

Martin Simmons <[email protected]>
Newsgroups gmane.lisp.lispworks.general
Message-ID <[email protected]>
Yes, you could define it as a generic function, but it is simpler to use
&allow-other-keys:

(defun some-fcn (record-type &rest initargs &key foo &allow-other-keys)
  (print initargs)
  (apply 'make-instance record-type initargs))

-- 
Martin Simmons
LispWorks Ltd
http://www.lispworks.com/



>>>>> On Mon, 5 May 2025 13:16:21 -0400, Paul Werkowski (as pw at snoopy dot qozzy dot com) said:
> 
> I repeal my bug comment.
> 
> A revision:
> 
> (defclass record ()
>    ((s1 :initarg :x)
>     (s2 :initarg :y)))
> 
> (defgeneric some-fcn (stream record-type &rest initargs))
> 
> (defmethod some-fcn (stream record-type &rest initargs)
>    (declare (ignore stream))
>    (print initargs)
>    (apply 'make-instance record-type initargs))
> 
> (defun test1 ()
>    (some-fcn  t 'record :x 1 :y 2))
> 
> CL-USER 20 > (test1)
> 
> (:X 1 :Y 2)
> #<RECORD 4010068E5B>
> 
> 
> 
> 
> On 5/5/2025 12:43 PM, Tim Bradshaw (as tfb at cley dot com) wrote:
> > On 5 May 2025, at 15:43, Michał phoe Herda (as phoe at disroot dot org) <[email protected]> wrote:
> >> No, they do not appear before &KEY, they appear right where they should
> > ... and in particular if that was legal then a function specified like that would have to accept any keyword arguments whatsoever, because the disallowed ones could always 'appear before &key'.  That would be very bad.
> >
> > --tim
> >
> > _______________________________________________
> > 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
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.