[cells-gtk-devel] Re: [cells-devel] Use of :initform c? and c-in

Kenny Tilton ktilton at nyc.rr.com
Tue Oct 4 02:16:20 UTC 2005



>OK, but "Deeply Correct" I think not. A function is just another type of 
>value. Its purpose in any given situation is defined by the /role/ it plays 
>in that situation. :initform is a role in the object creation process. We 
>shouldn't confuse the individual with some role played by the individual.
>
Just to confuse things, at one point Cells actually /did/ occupy the 
slot. The slot accessor handled the job of extracting a computed value 
and returned that. This would would also make debugging easier, but 
would be Deeply Wrong if we used this approach in something like 
AllegroStore which did Wonderful Things automatically off of slot values.

Also, re tfb's note on model-class effectively being a metaclass, at one 
point I /did/ use a metaclass to implement Cells and pulled it only 
because of portability, as you noted.

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

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?

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

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

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?

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.

kenny





More information about the cells-devel mailing list