-
-
Notifications
You must be signed in to change notification settings - Fork 403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
slot-value-using-class
to mark deprecated methods and add more metadata in general?
#2982
Comments
Hm, very interesting idea. Very interesting... |
Something signaled by @aadcg is that before releasing 4.0 we should grep all the "Deprecated ... Remove with 4.0". |
Something else that could help with deprecated functions / methods: (uiop:with-deprecation ((uiop:version-deprecation (asdf:system-version :nyxt)
:style-warning "3.2"
:warning "3.4"))
(defun foo ()
"Foo docstring"
17)) We could probably leverage this to deprecate slots via MOP. |
So what UIOP uses is compiler macros. Which is easy: generate a compiler macro around the accessor generic function and signal the error there: (define-compiler-macro ACCESSOR (&whole whole object)
;; Check for the type to avoid signaling deprecation for unaffected
;; accessors. FIXME: allows only one deprecation per accessor (=
;; only one of (name buffer) and (name window) would signal
;; deprecation if both are marked as deprecated here)...
(when (typep object 'CLASS)
;; Useful for debugging, given the notoriously opaque macro
;; expansion mechanisms.
(let ((form ',whole))
;; Should it be an `error'? UIOP does warnings on minor versions
;; and errors on major versions. But Nyxt handles lots of errors
;; gracefully enough by ignoring them.
(error
;; We have to write this `deprecated' condition ourselves.
'deprecated :version VERSION :form form :text "Deprecated in favor of NEW-ACCESSOR.")))) This approach is safe to use in EDIT: unfinished sentence. |
But that would fail if there is no accessor or if |
Yes, so we can go with a simpler solution before getting to heavy MOP artillery :P
Yes, that's a benefit, but the point above kinda makes it overkill :) |
The MOP based approach is trivial to implement though with https://github.com/some-mthfka/slot-extra-options, it's just
|
Maybe add a
slot-value-using-class
method for deprecated slots that warns the user on each read/write. Or maybe just on the first one.Originally posted by @Ambrevar in #2978 (comment)
The text was updated successfully, but these errors were encountered: