[PEAK] Trellis shared cells

Phillip J. Eby pje at telecommunity.com
Tue Dec 2 16:52:32 EST 2008


At 04:46 PM 12/2/2008 -0500, Phillip J. Eby wrote:
>At 11:57 AM 12/2/2008 -0800, Jeffrey Harris wrote:
>>This works fine, but it makes me uneasy.  trellis.changed is
>>undocumented, and I'm not sure this will continue to work in the future.
>>
>>If this *is* a reasonable way to work with shared cells, would it make
>>sense to make the trellis.changed call happen automatically when one
>>cell is switched out for another?
>
>Yes, I'd been thinking of doing just that (as Sergey said).
>
>But I would caution that use cases that seem to call for modifying a 
>cell in this fashion may have other, cleaner ways to be handled 
>anyway.  Perhaps you could elaborate on the use case?

I just glanced at your recent Chandler2 commit, and I think I see 
what you're using it for.  May I suggest that it might be cleaner to 
simply define the occurrence cells' formulas as something like:

  def some_attr(self):
      if 'some_attr' in self.modification_recipe.changes:
           # return modified value
      else:
           # return base value from self.master

In this way, you don't need non-local knowledge of the system in 
order to understand what's going on.

(Remember: a cell should ideally be set or calculated in only *one* place.)




More information about the PEAK mailing list