[email protected] writes:
> May be I don't understand something but  views "inheritance"
> with :inherit-from
> is instance-based not class-based.
>
> The only possible MOP here is to track access of `fields' slot with
> `slot-value-using-class'
> instead of compiler  hacking or find more general way to imitate
> prototype-based object system
> in CLOS.

(defun instance->initargs (inst)
  "Reverse-engineer initargs from INST."
  (let (args)
    (dolist (slot (class-slots (class-of inst)))
      (let ((slotn (slot-definition-name slot)))
        (awhen (and (slot-boundp inst slotn)
                    (slot-definition-initargs slot))
          (setf args (list* (slot-value inst slotn)
                            (first it)
                            args)))))
    (nreverse args)))

(instance->initargs
 (first (view-fields (defview-anon (:type form) (some-slot :requiredp t)))))
=> (:delayed-write-p nil :slot-name some-slot :hidep nil :prefix-fn nil 
:suffix-fn nil :label "Some Slot" :present-as #<input-presentation 
#x30004395523D> :parse-as #<text-parser #x3000439551FD> :satisfies nil 
:requiredp t)

-- 
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to