In case anyone was wondering, the reason this works when
now the next in queue of P is nothing.
doesn’t- or even
now the next in queue of P is the I6-nothing-constant.
(the I6-nothing-constant is defined in the standard rules as translating into I6 “nothing”)
It’s because I7’s usual in-play type-checking is (almost uniquely) suspended when assigning an I6 inclusion as the result of a ‘To decide which…’ phrase.
The danger of this is that we’re under the hood ‘blindly’ assigning a number, which could (in theory at least) represent not a person but anything, or random junk, or nothing at all.
In the case of ‘nothing’ we’re assigning the number 0, which has a special meaning in the context of objects as meaning ‘no object’ or ‘nothing’, which is pretty safe.
We could choose to assign a specific non-person object:
An aspidistra, a rubber plant and a cactus is in the Lab. The aspidistra object translates into I6 as "aspidistra_object".The rubber plant object translates into I6 as "rubber_plant_object".The cactus object translates into I6 as "cactus_object".
To decide which person is a random plant: (- ChoosePlant() -).
Include (-
[ ChoosePlant;
switch random(3) {
1: return aspidistra_object;
2: return rubber_plant_object;
3: return cactus_object;
];
-).
...
... now the next in queue of P is a random plant.
...
which will compile happily but is getting more dodgy, albeit still strictly assigning a thing, if not a person
or just a random number:
To decide which person is a catastrophic fail: (- (random(10000)) -).
which will also compile happily but is almost guaranteed to lead to runtime unpleasantness.
Which obliquely answers the question of why in I7 is strong type-checking implemented generally, and more specifically to largely exclude nulls- it’s to protect the author (and reader) as far as possible from the likelihood of runtime problems due to coding errors terminating the story or even crashing the interpreter. The price being loss of some flexibility in how things are coded.
EDIT: It’s a bit like Visual Basic (or at least VB as it was when I last used it, a decade ago)- if you wanted a variable to possibly hold a null value, you had to declare it as a Variant type- which could hold any variable type or null, similar to how an object variable/property in Inform 7 can hold any kind of object, or nothing.