[cells-devel] laziness -- what does "once-asked" mean?

Kenny Tilton kennytilton at optonline.net
Fri Aug 29 11:34:10 UTC 2008


Larry Clapp wrote:
> I understand (I think ...) what :once-asked *does*, I want to know
> what it *means*.
> 
> In other words, the other two options seem to answer the question
> "when is this cell lazy?"  Well, an :always cell is always lazy --
> it's not recalculated until and unless you ask for it.  An
> :until-asked cell is lazy until you query it once, then it's non-lazy
> from then on.
> 
> "once-asked" seems to answer a *different* question, "when is this
> cell evaluated?"  It's evaluated once, when created, and then only
> when queried.
> 
> Is there any single "question" that all three answer, or are they just
> inconsistent?

Once-asked would be "un-lazy until you query it once" (ie, consistent) 
but it also looks to be vestigial: all code seems to treat it the same 
as always.

If I missed it in my brief scan of the code, it would have to do with 
model instance initialization. Normal cells get evaluated and observed 
very soon after initialize-instance, during md-awaken. An always lazy 
cell just sits there until someone actually reads the corresponding 
slot-value, then resumses sitting and not reacting to dependencies. An 
until-asked cell likewise just sits there until the slot is read, but 
then recalculates when any dependency changes. A once-asked cell would 
calculate during md-awaken but then be lazy ever after.

So there may be a gap in the code or maybe I missed it. Lazy stuff does 
not get a lot of use so it is possible there is a hole there.

kt


-- 
http://www.theoryyalgebra.com/



More information about the cells-devel mailing list