|Anonymous | Login | Signup for a new account||2018-01-22 08:06 PST|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0001208||Documentation, Examples, and Web Site||Writing with Inform||public||2014-03-21 02:52||2014-05-07 07:38|
|Target Version||Fixed in Version||6L02|
|Summary||0001208: Repeat with precomputes the next iteration's value and is sometimes unsafe|
|Description||This is filed as a documentation issue because we figure you have good reasons for implementing it as you have, though if that's not the case please consider changing the implementation too!|
So in Kerkerkruip we've run into a nasty bug which was very hard to diagnose: https://github.com/i7/kerkerkruip/issues/258#issuecomment-38198215 [^]
The core of the problem is that repeat with loops precompute the next iteration's value. This causes problems if the code for the current iteration alters the next object so that it no longer qualifies.
The docs should be updated to make authors aware of this potential problem, and to suggest how to safely perform these loops. "while there is (description) (called H):" is a safe alternative.
|Tags||No tags attached.|
The precomputation supports the (presumed common) case:
repeat with T running through things in the pot: now T is off-stage;
...which uses a linked-list and would therefore choke without precomputation.
(Sure, *I* would use a "now all things in the pot..." statement here, but not everyone would.)
I feel like precomputation is going to give the desired result in "most" cases. I haven't done any systematic study, but I figure that the ideal behavior is to decide the entire iterator set in advance and then loop through it. This is impractical for memory reasons, but precompute-one is a step closer to it than naive iteration.
I took a look at the Kerkerkruip bug but I'm not sure what the loop structure is.
Hmm I guess the underlying issue is that the iteration functions require the object to still match the description in order to find the next one. I don't really know how those functions work, but I wonder if they couldn't just store an index instead?
Kerkerkruip loops through windows opening them one at a time. But some of the windows then open windows themselves. When it gets back to the original loop it already has the next iteration's window and opens it even though it's already open.
|I've added a note to the documentation.|
|2014-03-21 02:52||curiousdannii||New Issue|
|2014-03-21 10:05||zarf||Note Added: 0002582|
|2014-03-21 15:14||curiousdannii||Note Added: 0002583|
|2014-03-27 14:27||EmacsUser||Reproducibility||have not tried => N/A|
|2014-03-27 14:27||EmacsUser||Status||new => confirmed|
|2014-04-15 20:16||curiousdannii||Summary||Repeat with precomputes the next iteration's value and is unsafe => Repeat with precomputes the next iteration's value and is sometimes unsafe|
|2014-04-15 20:16||curiousdannii||Description Updated||View Revisions|
|2014-04-21 14:20||graham||Note Added: 0002632|
|2014-04-21 14:20||graham||Status||confirmed => resolved|
|2014-04-21 14:20||graham||Resolution||open => fixed|
|2014-04-21 14:20||graham||Assigned To||=> graham|
|2014-05-07 07:37||jmcgrew||Fixed in Version||=> 6L02|
|2014-05-07 07:38||jmcgrew||Status||resolved => closed|
|Copyright © 2000 - 2010 MantisBT Group|