Re: "Coherence" - a Trellis-like language w/error handling
Sergey Schetinin <[email protected]> Sat, 25 Apr 2009 13:14:48 +0300
| Newsgroups | gmane.comp.python.peak |
|---|---|
| Message-ID | <[email protected]> |
On Sat, Apr 25, 2009 at 12:31, Sergey Schetinin <[email protected]> wrote: > [email protected]_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.