[PEAK] "Coherence" - a Trellis-like language w/error handling
Sergey Schetinin
maluke at gmail.com
Sat Apr 25 06:14:48 EDT 2009
On Sat, Apr 25, 2009 at 12:31, Sergey Schetinin <maluke at gmail.com> wrote:
> @end.filter_assign
> def end_assign(self, end):
> self.start += end - self.end
> return end
I wonder what got into me implementing it like that, obviously it
should be "self.start = end - self.length".
In fact I already have a monkeypatch that allowed me to immediately
write and test this:
class Task1(Component):
attrs(name='task1', start=1, length=2)
@compute
def end(self):
return self.start + self.length
@end.writer
def end_write(self, end):
self.start = end - self.length
It works well for the trivial cases but writer is implemented rather
naively so this wouldn't work:
t1 = Task()
@trellis.atomically
def change():
t1.end = 20
t1.length = 10
it results in (t1.start, t1.end) == (18,28)
However if writer is implemented as a Cell that is scheduled on
assignment it would handle that no problem.
More information about the PEAK
mailing list