-
-
Notifications
You must be signed in to change notification settings - Fork 405
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
CLOS-style configuration #484
Conversation
This allows the user to easily subclass existing classes for use in Next.
Before we kept (make-instance 'minibuffer ...) because it gave us completion over `minibuffer' initargs. Since (make-instance *minibuffer-class* ...) does not complete its argument, we are better off using a wrapper now.
As opposed to what I said in #419, we don't have proper type-checking over (defun window-class-symbol-p (class-symbol)
(closer-mop:subclassp (find-class class-symbol)
(find-class 'window)))
(deftype window-type ()
`(satisfies window-class-symbol-p))
(declaim (type (window-type) *window-class*)) But note that SBCL fails to perform compile-time type-checking on non-top-level symbols because of the I guess it's not a big deal. Question is: should I even bother with the deftype then? |
As mentioned in #489, mode configuration still is a bit cumbersome. What about generating a This way configuring the class defaults would look like this:
Thoughts? |
I like the idea, but I feel like we could take it one step further using reader macros to possibly automate that whole process for the user... I need to think a little bit about it. As an aside, I am very much liking the CLOS style configuration, I think it is a fantastic idea! |
Macros or reader-macros? What do you have in mind?
|
I have reader macros in mind, I was thinking of a special syntax for people who are new, something to make things simple for them. On the other hand, maybe that is more suited to a |
I have implemented the same configuration approach for modes. Now mode defaults can be configured by define a subclass and then setting the (setf *web-mode-class* 'my-web-mode) |
Nice! |
Merged. I'll update the documentation just now. |
yes if it catches errors when loading the init file. |
I tried the example from the doc:
and I get:
on the setf. The example probably lacks a class inheritance. edit: OK, fixed. btw, if I'm not mistaken the type checks don't check slots types?
|
and I confirm for the missing type checks:
where search-engines is typed:
should fail. |
This should mostly fix #419.
Example init.lisp:
That's it!
Note that we can combine class settings by using multiple inheritance.