Yes, a very simple test example (attached) has the same behavior. The question is whether this is considered "broken", and what the desired behavior is. The PDDs are almost completely silent on the behavior of coroutines. Some options:
1) The coroutine can silently restart itself after returning, though we probably would like a mechanism to determine if it has restarted (when used as a iterator, we need to know when the iterator is finished, etc) 2) We add a new mechanism to reset the coroutine. We would need a way to ask the coroutine if it needs to be reset. Using the coroutine without resetting gives this same exception. If somebody can tell what the desired behavior is, I can "fix" this today. --Andrew Whitworth On Sun, Apr 11, 2010 at 3:25 AM, François Perrad <[email protected]> wrote: > I try to refactor runtime/parrot/library/TAP/parser.pir with a generator > (see attached patch) > > this naive implementation : > .sub '_get_results' > .param pmc parser > .local pmc result > result = new 'ResizablePMCArray' > L1: > $P0 = parser.'next'() > if null $P0 goto L2 > diag($P0) > push result, $P0 > goto L1 > L2: > .return (result) > .end > cannot work with more than 1 file. > And fails at the beginning of second file with the message : > Cannot resume dead coroutine. > > this other implementation with a Coroutine PMC : > .sub '_get_results' > .param pmc parser > .local pmc result > result = new 'ResizablePMCArray' > $P0 = get_hll_global ['TAP';'Parser'], 'next' > .local pmc coro > coro = new 'Coroutine', $P0 > L1: > $P0 = coro(parser) > if null $P0 goto L2 > diag($P0) > push result, $P0 > goto L1 > L2: > .return (result) > .end > fails with the message : > exists_keyed_str() not implemented in class 'Coroutine' > Something seems to be broken and parrot lacks of tests for this part. > > Any idea or help is welcome. > > François > > _______________________________________________ > http://lists.parrot.org/mailman/listinfo/parrot-dev > >
test.pir
Description: Binary data
_______________________________________________ http://lists.parrot.org/mailman/listinfo/parrot-dev
