|
From: | Stefan Monnier |
Subject: | bug#50219: 28.0.50; Provide better errors when trying to specialize on optional args in generic methods |
Date: | Sat, 28 Aug 2021 10:15:17 -0400 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Eric Abrahamsen [2021-08-26 18:31:44] wrote: > (cl-defmethod testy ((arg1 string) &optional (arg2 integer)) > (message "Don't do this")) [...] > Warning: reference to free variable 'integer' Hmm.... The same thing happens in Common-Lisp, tho. What's going on here is that the arglist of `cl-defmethod` allows Common-Lisp style arguments (e.g. `&key`) so your `(arg2 integer)` means to use `integer` as the default value for `arg2`, just as in (cl-defun testy (arg1 &optional (arg2 integer)) ...) -- Stefan
[Prev in Thread] | Current Thread | [Next in Thread] |