Subject: bug#47552: 27.1; cl-defstruct field names matching read-only variables -> bad code

From: Lars Ingebrigtsen <[email-masked]>
Date: Sun, 11 Apr 2021 18:31:20 +0200

Stefan Monnier <[email-masked]> writes:

> I'm pretty sure that's the right solution, *but* I don't think it's
> obvious how to get there: `cl-defstruct` defines the constructor
> using `cl-defsubst` and its `&key` arguments, so the `:gcs-gone` keyword
> argument inevitably maps to a `gcs-done` variable by definition of how
> `&key` is supposed to work.

I'm having a hard time following the code in cl-defstruct -- even where
things are actually defined.

But...  Indeed doing this "doesn't work":

(cl-defsubst foo4 (&key gcs-done)
  gcs-done)

(foo4 :foo 1)
-> Debugger entered--Lisp error: (wrong-type-argument numberp nil)

But:

(foo4 :gcs-done 1)
=> 1

Hm...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no