Jan Rychter <[email protected]> writes:
> nunb <[email protected]> writes:
> Thanks to everyone for the very helpful comments. I think I have a good
> idea of what is wrong with our current views and how to fix it. I'll try
> to work on it after I finish the navigation-rewrite branch, as time
> permits. As usual, I'll do lots of experimentation to see what works and
> what doesn't.
Here's something I was throwing together just before disappearing:
(in-package #:weblocks)
#|
A new design for scaffolding views
* Specify view elements with slot kwargs
* :weblocks- always stripped
* CLOS-specced kwargs are always removed, but..
* :reader bool :writer bool :accessor bool is stripped and used
to override scaffold default rules
* :weblocks-view (view-names ...) ...args-for-only-this-view...
* The :scaffold pseudo-view is default
Slava wrote about the problems with strictly using information about a
class from defclass and the MOP to determine scaffolds. We can't use
new slot definition classes to keep the extra information we want,
because stores commonly do that for us, and anyway we still want the
store classes to strictly reflect the storage information.
But *syntactically*, we would like to provide information for views
within the class definitions. Fortunately, stores tend to either
publish a metaclass to use or a form very similar to `defclass'. In
these cases we can preprocess the defclass or defclass-like forms
directly to extract view-related information.
Note that for basic scaffolds, wrapping store classes with
`weave-scaffold-views' is unnecessary. However, to access the extra
features it provides, it must be used.
|#
(wexport '(weave-scaffold-views))
(defconstant +amop-slot-definition-keywords+
(if (boundp '+amop-slot-definition-keywords+)
+amop-slot-definition-keywords+
'(:allocation :initform :reader :writer :accessor :initarg :type))
"Keyword arguments accepted by `standard-direct-slot-definition's
via `defclass' forms. They are ignored by `weave-scaffold-views' when
constructing scaffold views.")
(defun weave-scaffold-class+views (class-form)
"Helper for `weave-scaffold-views'."
(destructuring-bind (defclass-macro-name defclass-name (&rest defclass-supers)
(&rest defclass-slots)
&rest defclass-params) class-form
(let ((views (make-hash-table :test 'eq))
new-defclass-slots)
(loop for (slotname . slotargs) in defclass-slots
do (loop with new-slotargs = '()
for (argnm argval) on slotargs
do (cond ((and (find argnm '(:reader :writer :accessor))
(typep argval 'boolean))
#|TODO save accessibility and skip|#)
((find argnm +amop-slot-definition-keywords+)
#|TODO drop|#)
(t #|TODO save to view|#
(setf new-defclass-slots
(list* argval argnm new-slotargs))))))
(values `(,defclass-macro-name ,defclass-name ,defclass-supers
,(nreverse new-defclass-slots)
. ,defclass-params)
'())))
(defmacro weave-scaffold-views (&rest class-forms)
"Output the body, a `defclass'-like form, with parts removed as
described, followed by definitions of views for objects of
DEFCLASS-NAME."
`(progn ,@(mapcar (f_ (multiple-value-bind (class forms)
(weave-scaffold-class+views _)
`(prog1 ,class ,@forms)))
class-forms)))
;;; Anyway you get the idea.
--
Sorry but you say Nibiru is a Hoax? Doesnt Exist? So maybe The
Sumerian people doesnt exist also! --Anonymous by way of SkI
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"weblocks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/weblocks?hl=en
-~----------~----~----~----~------~----~------~--~---