wanted: (SETF %FUN-NAME) on closures, or %SET-CLOSURE-NAME
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Wishlist
|
Douglas Katzman |
Bug Description
%FUN-NAME does not work on slot accessors, predicates, copiers
created by means of DEFSTRUCT.
Using (SETF %FUN-NAME) when creating the defstruct slot-accessors,
predicates, copiers won't do because (SETF %FUN-NAME) modifies the
underlying function of a closure, and all these are closures
sharing the same underlying function.
;;; Test case for defstruct.
;;; If this is fixed, uncomment the FUNCTION-
;;; the SB-INTROSPECT contrib.
(with-test (:name defstruct+
(assert (eq (sb-kernel:
(assert (eq (sb-kernel:
(assert (eq (sb-kernel:
(assert (eq (sb-kernel:
(assert (eq (sb-kernel:
description: | updated |
description: | updated |
summary: |
- SB-KERNEL:%FUN-NAME on functions created by DEFSTRUCT + wanted: (SETF %FUN-NAME) on closures, or %SET-CLOSURE-NAME |
Changed in sbcl: | |
importance: | Undecided → Wishlist |
status: | New → Confirmed |
The implementation of defstruct accessors is different from what was described above - the predicate, copier, and accessors are genuine DEFUNs, not closures. As such, they have names.
Also, we have the ability to rename closures now (as of commit 111d187a4e82eb5 8f4013190ac330b c7c1efcc95) , it operates in a way which may not meet users' expectations: naming a closure returns a new object.
So while I'm resolving this as "fixed", I don't think we should advertise named closures as a news item.