Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002034Core InformPhrases and functional programmingpublic2017-10-12 22:562017-10-13 08:38
Reporterotistdog 
Assigned To 
PrioritynormalSeverityseriousReproducibilityalways
StatusnewResolutionopen 
Platformx86OSWindowsOS Version7
Product Version6M62 
Target VersionFixed in Version 
Summary0002034: Sayable values using temporary value cause failure of text in "end the story saying" phrase?
DescriptionPlacing certain sayable values in the text of an "end the story saying..." phrase causes the entire text string to be evaluated as empty. Specifically, the issue seems to be with sayable values that are temporary values. (At least, that's how it seems.)
Minimal Source Text To Reproduce
"Bug Report"

Place is a room.

After waving hands:
	let C be the actor;
	say "<[C] is the actor>[line break]";
	if we have jumped:
		end the story saying "Yay! [C] jumped!";
	otherwise:
		end the story saying "Yay!"

Test me with "jump / wave".
Additional InformationAs you can see, C is set correctly and can be used as a sayable value. Note that the issue seems to be linked to trying to say a temporary value in the "end the story saying..." text, as replacing the line with

end the story saying "Yay! [regarding the actor][They] jumped!";

works as would be naively expected.

(Also: Yes, I realize that even if the minimal source example submitted worked as intended, it would function poorly. It was just the quickest demonstration of the issue.)

Filed under "phrases and functional programming" because "end the story..." is a built-in phrase. Feel free to recategorize.
TagsNo tags attached.
Effect(serious/mild) Game compiles but misbehaves
Attached Files

- Relationships

-  Notes
(0004734)
zarf (developer)
2017-10-13 08:38

I think what's going on is that "end the story saying T" implicitly assigns T to an I6 global variable. If it were an I7 global variable, then it would be kept alive by reference counting or whatever the block handling system uses. (I'm not super clear on that.)

So this works:

TT is a text that varies.

After jumping:
	let C be the actor;
	now TT is "Yay! [C] jumped!";
	say "<[C] is the actor>[line break]";
	end the story saying TT;


But this does not:

After jumping:
	let C be the actor;
	let T be "Yay! [C] jumped!";
	say "<[C] is the actor>[line break]";
	end the story saying T;


Because (I think) the text object gets deallocated at the end of the function.

Not sure what the fix is, but you can use the global variable as a workaround.

- Issue History
Date Modified Username Field Change
2017-10-12 22:56 otistdog New Issue
2017-10-13 08:38 zarf Note Added: 0004734


Copyright © 2000 - 2010 MantisBT Group
Powered by Mantis Bugtracker