§21.2, which is discussing how it is impossible to create a variable whose value is initially set to the empty list, says:
On the other hand, writing
let M be { };
is fine provided that M already exists, and then does the obvious thing - empties M.
This is only fine if M was created as a temporary variable in the same code block. If M is a global, then youâll run into the usual issue where Inform tries to create a separate temp variable named âMâ (and in this case, it will fail because it doesnât know what kind of value is in the list).
Steps to reproduce :
Lab is a room.
N is a list of numbers that varies. N is {100}.
Every turn: say N.
Carry out jumping:
let N be a list of numbers;
let N be { }.
Additional information :
It seems like it would probably be less misleading to change the second "let" to "now"--in general I don't think there's any reason to change the values of existing variables with "let," because "now" works for temporary variables, and using "let" for globals leads to nasty and hard-to-find bugs.
Reported by : mattweiner
Description :
§21.2, which is discussing how it is impossible to create a variable whose value is initially set to the empty list, says:
On the other hand, writing
let M be { };
is fine provided that M already exists, and then does the obvious thing - empties M.
This is only fine if M was created as a temporary variable in the same code block. If M is a global, then youâll run into the usual issue where Inform tries to create a separate temp variable named âMâ (and in this case, it will fail because it doesnât know what kind of value is in the list).
Steps to reproduce :
Additional information :
It seems like it would probably be less misleading to change the second "let" to "now"--in general I don't think there's any reason to change the values of existing variables with "let," because "now" works for temporary variables, and using "let" for globals leads to nasty and hard-to-find bugs.
imported from: [Mantis 2098] §21.2 suggests changing the value of a variable with "let"