P.J. Eby | 17 Jul 2011 03:17
Gravatar

Re: trellis question

At 11:33 PM 7/16/2011 +0200, nicky van foreest wrote:
>I wonder how trellis finds out that Sum.tot needs h.a for all the h's
>in the list. How does it know, for instance, that h.a in the list
>comprension sum( h.a for h in self.h) corresponds to a Cell? (Is
>actually h.a stored/corresponds to a Cell?)

Yes.  A trellis.attr declaration means the attribute is stored in a 
Cell instance, and reading the attribute reads the Cell, causing the 
dependency to be noticed while the 'tot' rule is being 
executed.  When the 'tot' rule is finished, Trellis looks at the read 
history and sees the list of cells to be used as the new dependency 
list for the 'tot' Cell. 
nicky van foreest | 17 Jul 2011 21:48
Picon

Re: trellis question

Thanks. I'll try to understand this idea from the code.

On 17 July 2011 03:17, P.J. Eby <pje@...> wrote:
> At 11:33 PM 7/16/2011 +0200, nicky van foreest wrote:
>>
>> I wonder how trellis finds out that Sum.tot needs h.a for all the h's
>> in the list. How does it know, for instance, that h.a in the list
>> comprension sum( h.a for h in self.h) corresponds to a Cell? (Is
>> actually h.a stored/corresponds to a Cell?)
>
> Yes.  A trellis.attr declaration means the attribute is stored in a Cell
> instance, and reading the attribute reads the Cell, causing the dependency
> to be noticed while the 'tot' rule is being executed.  When the 'tot' rule
> is finished, Trellis looks at the read history and sees the list of cells to
> be used as the new dependency list for the 'tot' Cell.
>

Gmane