On Monday 03 October 2005 22:16, Kenny Tilton wrote:
From the hyperspec:
"The :initform slot option is used to provide a default initial value form to be used in the initialization of the slot. This form is evaluated every time it is used to initialize the slot." -- see, it says "every time it is used to initialize the slot" not "every time the slot is accessed."
Ah, but this describes exactly what is going on. You are confusing the stream of values coming from a formula with non-cell values normally used to initialize a slot. The one-time intialization is still present, it is just that the thing being bound to the slot is a formula or c-input (which really does no more than support an optimization).
by the way, you never explained to me how to resolve conflicts in the class precedence list where one class specifies an initform and another specifies an :initcell.
I think the whole question is confused by not recognizing that the set of notions (initargs, :default-initargs, :initform) address a different concern than does :formula. Those three are about providing an initial value, :formula (or any declaration that "this slot is a cell-slot") is about providing reader and writer functions. Once you assert that access to the slot's value is provided through a cell's accessor, you have effectively disconnected from the documented meaning of initargs, :default-initargs and :initform. You can, as far as I am concerned, disallow or ignore the use of any of these on a cells slot. Perhaps you would be better off using a cells-specific constructor rather than make-instance, since cells doesn't use the usual semantics of the initargs. -- But, hey, if you are going to say "its sooo... easy" sure stick with it. I don't care. I'm trying to help, not trying to be critical.
Also, what do we do about:
(make-instance 'republican :indictments (c-formula ()
(years-in-office self)))
That would override an initform or :default-initarg. How are cells supplied at make-instance time in your scheme?
(mk-republican 'indictments (c-formula () (months-in-office self)))
indictments names a slot, it might not be an initarg.
I'd call the role :formula or even better :derived-by, not :initformula, but what's in a name? (provided that name doesn't already associate with a meaning, as does :initform).
i think the problem of the initform not actually becoming the slot value is a problem only for those who have never seen Cells before and have not had the briefest introduction. So I say leave it as it is an explain it. :)
Sure, it can be learned. Like GTK itself, I have just enough knowledge of Cells to be dangerous. My concern is getting cells-gtk users up to speed as quickly as possible. Definitions of the concepts used, and predictable semantics of the language are the what makes our work effective (and why we like lisp -- compare with Perl or Python, where the semantics change often, and are ill-defined).
But of course there are only so many hours in the day, and so much to do. So nothing is ever going to be perfect.
Could someone somewhere explain to me what is so hard to understand about:
(make-instance 'rect :area (c? (* (length self) (width self))))
Looks fine to me.
Seriously. I realize it is astonishing that it works, but what else? Let's add:
(def-c-output area ((self room) new-value old-value) (when (> new-value (area (carpet self))) <trigger electronic ordering of new carpet>)))
Also looks fine.
There are a lot of examples in the test suite with some pretty simple relationships. Am I the only one who prefers examples to turgid, abstract documentation trying to sound like a PhD thesis by using big words and never saying what they really mean?
Well, I hope I am not being turgid or using big words. After seeing a couple of examples, I like definitions. So far I have this:
A C-INPUT CELL is a cell whose value may be set through explicit procedural code, using setf on the slot. Setf-ing the cell typically causes the values of other cells to be recomputed.
A C-FORMULA CELL is a cell whose value is obtained through evaluation of a formula.
Note that the usual semantics of :initform do not apply when :initform is given by c-formula. Instead of just setting the value at initialization, the c-formula (an arbitrary lisp form) specifies the dynamic relationship between the slot's value and other aspects of the program state.
I don't have a definition of "cell" but I think it is might be:
"A CELL is a slot in a CLOS object whose value is managed by readers and writers that are part of a cells constraint network."
It would be useful to have definition of the 'fm' methods.
As far as I can tell, (fm-find-one top name) just does this:
(depth-first-search top #'(lambda (x) (eql (md-name x) name)) #'kids)))
So how about
fm-other - fm-other? - fm-traverse - fm-other-v - fm! - fm^ -
I can see questions about obscure syntax or edge cases, but not something basic like the use of :initform to supply the cell that will be mediating a slot.
It's OK with me if this isn't discussed further. Again, I am just trying to get some documentation for cells-gtk.