[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Edit a cl-struct by copy, or, slot-value for cl-structs
From: |
Stefan Monnier |
Subject: |
Re: Edit a cl-struct by copy, or, slot-value for cl-structs |
Date: |
Sun, 31 Oct 2021 14:52:28 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
>>> (mapcar #'cl--slot-descriptor-name
>>> (cl--struct-class-slots (get (type-of obj) 'cl--class)))
>>>
>>> But I can’t get any further as I can’t find any generic getter and
>>> setter for cl-struct’s. Something like slot-value. So close!
FWIW, I just pushed to `master` a patch which makes `slot-value` work to
read slots from structs. It doesn't help you, tho, because it still
doesn't let you set them, and in your case it really shouldn't since
they are defined as read-only.
>> and then use (my-foo-with foo :c 42) and (my-foo-with-a foo 153 "42”)
> That’s cool. But my lazy fingers like better to write a single function and
> use it for everything ;-)
But that tends to come at a performance cost.
Stefan
- Edit a cl-struct by copy, or, slot-value for cl-structs, Yuan Fu, 2021/10/29
- Re: Edit a cl-struct by copy, or, slot-value for cl-structs, Emanuel Berg, 2021/10/29
- Re: Edit a cl-struct by copy, or, slot-value for cl-structs, Stefan Monnier, 2021/10/29
- Re: Edit a cl-struct by copy, or, slot-value for cl-structs, Michael Heerdegen, 2021/10/29