[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#47552: 27.1; cl-defstruct field names matching read-only variables -
From: |
Lars Ingebrigtsen |
Subject: |
bug#47552: 27.1; cl-defstruct field names matching read-only variables -> bad code |
Date: |
Sun, 11 Apr 2021 18:31:20 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Stefan Monnier <monnier@iro.umontreal.ca> 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