[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-dev] [patch] bugfix: Pmono vs. rest events



Hi James:

> 
> EventStreamCleanup could use a refactoring, but it escapes me where the improvements could be made. The older approach was a simpler interface, but led to child streams evaluating unnecessarily when a parent stopped and passed "nil" down as the inval. One way around that would be to pass down a special value, maybe a symbol like \doCleanup, that child patterns could use as a sign to exit instead of evaluating. (Nil is not really suitable because we expect to make a stream such as Pseries(0, 1, inf) and then call .next with no argument -- from a value stream's perspective, there was no way in the old implementation to distinguish between "normal case, give me the next value" and "no worries, just telling you that I'm stopping.")

My recollection it that a problem with passing down a special value is that in the most natural implementation it  causes 
substreams to move forward an increment.
That will break any reuse of streams (i.e. interactively stopping and restarting a single event stream in a performance).

> 
> EventStreamCleanup eliminates the need to pass a signal down, but it is admittedly more complex and surprisingly easy to use incorrectly. I think I understand it as well as anybody but even I mess it up sometimes (although today's bug fix is not actually for wrong use of EventStreamCleanup -- it's for doing some initialization under conditions that would not complete the initialization).
> 
> But, EventStreamCleanup is in itself algorithmically correct. It follows sensible rules and it doesn't leave garbage behind. The issue is just doing things with it in the right sequence. The Practical Guide to Patterns does document it, in the final chapter.

RJK
_______________________________________________
sc-dev mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-dev/
search: https://listarc.bham.ac.uk/lists/sc-dev/search/