curiousdannii-testing / inform7-imported-bugs

0 stars 0 forks source link

[I7-2030] [Mantis 2067] Extending 'show' to work for any visible noun creates infinite loop. Probably #54

Closed curiousdannii-testing closed 2 years ago

curiousdannii-testing commented 2 years ago

Reported by : lpsmith

Description :

I wanted to extend 'show' so that I didn't have to be holding the thing. This caused an infinite loop.

Steps to reproduce :

"Lucian's Room in Cragne Manor" by Lucian Smith

Errors1 is a room.  

Emmett is a man in Errors1

Understand "show [any visible thing] to [Emmett]" as showing it to.

Additional information :

Lucian's Room in Cragne Manor
An Interactive Fiction by Lucian Smith
Release 1 / Serial number 180728 / Inform 7 build 6M62 (I6/v6.33 lib 6/12N) SD

Errors1
You can see Emmett here.

>show apple to emmett
Fatal Error: Stack overflow

imported from: [Mantis 2067] Extending 'show' to work for any visible noun creates infinite loop. Probably
  • status: Closed
  • resolution: Resolved
  • resolved: 2022-04-10T04:09:26+10:00
  • imported: 2022/01/10
curiousdannii-testing commented 2 years ago

557058:4c095ffd-6d6f-47ce-9e73-77c613347b86:

Comment by zarf :
This happens if you put "visible" in any noun token. I.e.:

Understand "touch [any visible thing]" as touching.

The parser is not designed to handle that. I don't know whether Graham will want to add a run-time error for it, but the practical answer is "don't do that."

It sounds like you want to retroactively change the action definition – that is, you want that grammar line to behave as if

Showing it to is an action applying to one visible thing and one visible thing.

However, this is currently not possible. Grammar lines can't change the action declaration. In fact there's no way to redefine an action once it's declared; the only path is to define a new action with a new name.

curiousdannii-testing commented 2 years ago

557058:4c095ffd-6d6f-47ce-9e73-77c613347b86:

Comment by mattweiner :
For the record, the "Lollipop Guild" example in the documentation covers how to override the carrying requirements for showing. Showing could probably be easily extended to all visible things by a reaching inside rule, like "A rule for reaching inside when showing: allow access."

curiousdannii-testing commented 2 years ago

61eedb62875fc10070240916:

Resolved by this commit:

https://github.com/ganelson/inform/commit/07660ac6c079278dfe23716380de0c0ec39fda38

Comment from Graham Nelson:
The comments are right about why the sample program cannot expect this to work, but it's a bug that the result is infinite regression and a crash at run-time. This is now fixed, and the result is that "[any visible noun]" works as expected, and then the parser says that the noun isn't appropriate for the action, as indeed it should.