![]() | Chapter 23: Extensions | ![]() ![]() |
23.19. Longer extracts of Inform 6 code |
Whole routines, object and class definitions (or any other directives) can be pasted in wholesale using sentences like so:
Include (-
[ MyInform6Routine a b; return a*b; ];
-).
Such inclusions are pasted into the final compiled code at the end of the file, after the I6 grammar has been declared.
In such extracts, we sometimes need to refer to objects, variables or values which can't be described using I6: or rather, which can be described, but we don't know how. To this end, any text in an inclusion written in "(+" and "+)" parentheses is treated as an I7 value, and compiled accordingly, with all type-checking waived for the occasion. For instance:
Include (-
Global my_global = (+ the tartan rucksack +);
-).
Here "the tartan rucksack" is translated into "O18_tartan_rucksack", or something similar: the I6 object created to represent the rucksack. Thus the actual line of code produced is
Global my_global = O18_tartan_rucksack;
Note that the brace notation seen before for Inform 6-defined inline phrases is not allowed here. But this is better anyway.
The Standard Rules make use of the notation:
Include (-
...
-) before the library.
the reference being to the I6 code appearing before the I6 library is included. Extension writers are asked not to use this if they can possibly avoid it, and are warned that creating I6 attributes or properties may cause I7 code to misbehave. (If new properties are needed, they should be created in I7 and referred to using the "(+" notation.)
| ![]() A status line which has only the name of the location, centered. |
|
Previous | Contents | Next |