-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Malformed EVENT Causes Terp to Freeze/Hang For Ever #20
Comments
It looks like the problem is the line scheduling the event after 0:
which causing an infinite regression of the EVENT (it was a typo on my side, instead of Should the compiler be able to catch similar infinite regressions? In theory, there could be an EVENT that needs to be executed multiple times in the same turn (due to some conditional statements), but it sounds a bad idea anyways. Even if an EVENT was allowed to schedule itself Does it make sense? |
I think you are correct (I haven't created a test case yet...), scheduling an event And prohibiting that is not the best solution either since an event could schedule itself conditionally to create a "multi-triggering" event, or you might schedule a series of events (I'm thinking a bomb event scheduling scrapnel-throwing events at nearby locations). So I'm not sure what the compiler can actually do. A warning perhaps? But a limit in the interpreter is at least better than nothing, and should probably be implemented anyhow. |
Indeed, it's a puzzling issue. In itself, there's nothing syntactically wrong about, and there are legitimate uses for this. But then, usually most applications that contemplate recursive calls do set a limit to prevent the machine hanging (or worst, crashing). So, if it's true that authors shouldn't be prevented from such cases, it's possibly also legitimate to implement on the interpreter some sort of safety mechanism to prevent unlimited looping. I'm thinking, as a comparison, to various syntax parsers that allow nested constructs; they usually have a threshold that prevents recursing beyond a certain number of times (although this is usually due to true recursive functions, without tail recursion, which end up piling stack frames, which consumes memory very fast). |
I've encountered a bug related to EVENTs and RULEs.
When I've added the following code to a pre-existing adventure, the compiled game would hang forever on entering the
level5
location:I wasn't able to provide a link to the full adventure because it was a WIP adventure that wasn't committed to any repository, but I'm positively sure that the above code was the sole culprit of the terp hanging.
Possibly this leads to a stall situation which is not being foreseen by the compiler.
The text was updated successfully, but these errors were encountered: