Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000968Core InformListspublic2012-08-05 18:322014-05-07 07:33
Reporterjmcgrew 
Assigned Tograham 
PrioritynormalSeveritymildReproducibilityalways
StatusclosedResolutionfixed 
Platformx86OSWindowsOS Version7
Product Version6G60 
Target VersionFixed in Version6L02 
Summary0000968: "repeat with X running through (list)" re-evaluates the list expression each time
DescriptionThe code below should print the same list twice, but instead it prints:

<quote>
"a random decade" = list of numbers: {1900, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909}
"N" = number: 1900
"N" = number: 1921
"N" = number: 1962
"N" = number: 1913
"N" = number: 1984
"N" = number: 1955
"N" = number: 1966
"N" = number: 1907
"N" = number: 1948
"N" = number: 1909</quote>

The generated code shows that I7 is re-evaluating "a random decade" on each iteration, so each iteration prints a number from a different list.

<code>
      ! [4: repeat with n running through a random decade begin]
       for (t_1=1, t_0=LIST_OF_TY_GetItem((PHR_740_r3 ((blockv_stack-->(I7BASPL+2)))), t_1, true): t_1<=LIST_OF_TY_GetLength((PHR_740_r3 ((blockv_stack-->(I7BASPL+3))))): t_1++, t_0=LIST_OF_TY_GetItem((PHR_740_r3 ((blockv_stack-->(I7BASPL+4)))), t_1, true)) {
</code>
Minimal Source Text To Reproduce
Home is a room.

To decide which list of numbers is a random decade:
	let L be a list of numbers;
	let N be a random number between 190 and 200;
	repeat with M running from 0 to 9:
		add (N * 10) + M to L;
	decide on L.

When play begins:
	seed the random-number generator with 1;
	showme a random decade;
	seed the random-number generator with 1;
	repeat with N running through a random decade:
		showme N.
Additional InformationWorkaround: assign the list to a temporary variable first.
TagsNo tags attached.
Effect(serious/mild) Game compiles but misbehaves
Attached Files

- Relationships
related to 0000969closedgraham "repeat with X running through (description)" re-evaluates subexpressions each time 

-  Notes
(0002380)
graham (administrator)
2014-01-26 02:30

Fixed. I think this was designed at a more Z-machine-centric time, when the shortage of local variables was a big deal. That's really the only excuse.

- Issue History
Date Modified Username Field Change
2012-08-05 18:32 jmcgrew New Issue
2012-08-05 18:57 EmacsUser Status new => confirmed
2012-08-05 19:07 jmcgrew Relationship added related to 0000969
2014-01-26 02:30 graham Note Added: 0002380
2014-01-26 02:30 graham Status confirmed => resolved
2014-01-26 02:30 graham Resolution open => fixed
2014-01-26 02:30 graham Assigned To => graham
2014-05-07 07:32 jmcgrew Fixed in Version => 6L02
2014-05-07 07:33 jmcgrew Status resolved => closed


Copyright © 2000 - 2010 MantisBT Group
Powered by Mantis Bugtracker