396261f556cfcc55212b9f8cfaf073cbbc2af6ac
[ibg.git] / chapters / 14.rst
1 ========================
2  Some last lousy points
3 ========================
4
5 .. highlight:: inform
6
7 .. default-role:: samp
8
9 .. only:: html
10
11   .. image:: /images/picF.png
12      :align: left
13
14 |F|\inally our three example games are written; we've shown you as much of
15 the Inform language as we've needed to, and made a lot of observations
16 about how and why something should be done. Despite all that, there's much
17 that we've left unsaid, or touched on only lightly. In this chapter we'll
18 revisit key topics and review some of the more significant omissions, to
19 give you a better feel for what's important, and what can be ignored for
20 the time being; when you become an accomplished designer, you will decide
21 what matters and what can be left on the shelf.
22
23 We'll also talk, in :ref:`reading-other-code`, about a few ways of doing
24 things that we've chosen not to tell you about, but which you're quite
25 likely to encounter if you look at Inform code written by other designers.
26
27 The tone here is perhaps a little dry, but trust us: in walking this dusty
28 ground we touch on just about everything that is fundamental in your
29 overall understanding of Inform. And as always, the |DM4| provides rounder
30 and more comprehensive coverage.
31
32 Expressions
33 ===========
34
35 In this guide we’ve used the placeholder `{expression}` a few times; 
36 here's roughly what we mean.
37
38 * An `{expression}` is a single `{value}`, or several `{values}` 
39   combined using `{operators}` and sometimes parentheses ``(...)``.
40
41 * Possible `{values}` include:
42
43   * a literal number (-32768 to 32767)
44
45   * something that's represented as a number (a character ``'a'`` , a 
46     dictionary word ``'aardvark'`` , a string ``"aardvark's adventure"`` 
47     or an action ``##Look`` )
48
49   * the internal identifier of a constant, an object, a class or a routine
50
51   * (only in a run-time statement, not in a compile-time directive) the
52     contents of a variable, or the return value from a routine.
53
54 * Possible `{operators}` include:
55
56   * an arithmetic operator: ``+ - * / % ++``
57   * a bitwise logical operator: ``& | ~``
58   * a numeric comparison operator: ``== ~= > < >= <=``
59   * an object conditional operator: ``ofclass in notin provides has hasnt``
60   * a boolean combinational operator: ``&& || ~~``
61
62 Internal IDs
63 ============
64
65 Many of the items which you define in your source file -- objects, 
66 variables, routines, etc. -- need to be given a name so that other items 
67 can refer to them. We call this name an item's internal identifier 
68 (because it's used only within the source file and isn't visible to the 
69 player), and we use the placeholders `{obj_id}`, `{var_id}`, 
70 `{routine_id}`, etc. to represent where it's used. An internal ID
71
72 * can be up to thirty-two characters long
73
74 * must start with a letter or underscore, and then continue with letters 
75   ``A-Z`` , underscore ``_`` and digits ``0-9`` (where upper-case and 
76   lower-case letters are treated as indistinguishable)
77
78 * should generally be unique across all files: your source file, the 
79   standard library files, and any library contributions which you've 
80   used (except that a routine's local variables are not visible outside 
81   that routine).
82
83 .. _statements:
84
85 Statements
86 ==========
87
88 .. todo::
89
90    We might need some custom syntax highlighting here.
91
92 A :term:`statement` is an instruction intended for the interpreter, telling
93 it what to do at run-time. It *must* be given in lower-case, and always
94 ends with a semicolon.
95
96 Some statements, like ``if``, control one or more other statements. We 
97 use the placeholder `{statement_block}` to represent either a single 
98 `{statement}`, or any number of `{statements}` enclosed in braces::
99
100   statement;
101
102   { statement; statement; ... statement; }
103
104 Statements that we've met
105 -------------------------
106
107 Our games have used these statements, about half of the Inform 
108 possibilities::
109
110   give obj_id attribute;
111   give obj_id attribute attribute ... attribute;
112
113   if (expression) statement_block
114   if (expression) statement_block else statement_block
115
116   move obj_id to parent_obj_id;
117
118   objectloop (var_id) statement_block
119
120   print value;
121   print value, value, ... value;
122
123   print_ret value;
124   print_ret value, value, ... value;
125
126   remove obj_id;
127
128   return false;
129   return true;
130
131   style underline; print...; style roman;
132
133   switch (expression) {
134       value: statement; statement; ... statement;
135       ...
136       default: statement; statement; ... statement;
137   }
138
139   "string";
140   "string", value, ... value;
141
142   <action>;
143   <action noun>;
144   <action noun second>;
145
146   <<action>>;
147   <<action noun>>;
148   <<action noun second>>;
149
150 Statements that we've not met
151 -----------------------------
152
153 Although our example games haven't needed to use them, these looping
154 statements are sometimes useful::
155
156   break;
157   continue;
158
159   do statement_block until (expression)
160
161   for (set_var : loop_while_expression : update_var) statement_block
162
163   while (expression) statement_block
164
165 On the other hand, we suggest that you put the following statements on 
166 hold for now; they're not immediately relevant to everyday code and have 
167 mostly to do with printing and formatting::
168
169   box
170   font
171   jump
172   new_line
173   spaces
174   string
175
176 In particular, avoid using the deprecated jump statement if you possibly can.
177
178 Print rules
179 -----------
180
181 In ``print`` and ``print_ret`` statements, each `{value}` can be:
182
183 * a numeric `{expression}`, displayed as a signed decimal number,
184
185 * a `"{string}"`, displayed literally, or
186
187 * a print rule. You can create your own, or use a standard one, including:
188
189   .. tabularcolumns:: ll
190
191   +-------------------------+---------------------------------------------------+
192   | `(a) {obj_id}`          | the object's name, preceded by "a", "an" or "some"|
193   +-------------------------+---------------------------------------------------+
194   | `(A) {obj_id}`          | as ``(a)`` but using "A", "An" or "Some"          |
195   +-------------------------+---------------------------------------------------+
196   | `(the) {obj_id}`        | the object's name, preceded by "the"              |
197   +-------------------------+---------------------------------------------------+
198   | `(The) {obj_id}`        | as ``(the)`` but using "The"                      |       
199   +-------------------------+---------------------------------------------------+
200   | `(number) {expression}` | the numeric expression's value in words           |
201   +-------------------------+---------------------------------------------------+
202
203 Directives
204 ==========
205
206 A :term:`directive` is an instruction intended for the compiler, telling it
207 what to do at compile-time, while the source file is being translated into
208 Z-code. By convention it's given an initial capital letter (though the
209 compiler doesn't enforce this) and always ends with a semicolon.
210
211 Directives that we've met
212 -------------------------
213
214 We've used all of these directives; note that for ``Class``, ``Extend``, 
215 ``Object`` and ``Verb`` the full supported syntax is more sophisticated 
216 than the basic form presented here::
217
218   Class   class_id
219     with  property  value,
220           property  value,
221           ...
222           property  value,
223     has   attribute  attribute  ...  attribute;
224
225   Constant  const_id:
226   Constant  const_id = expression;
227   Constant  const_id expression;
228
229   Extend 'verb'
230       * token  token  ...  token -> action
231       * token  token  ...  token -> action
232       ...
233       * token  token  ...  token -> action
234
235   Include "filename";
236
237   Object  obj_id  "external_name"  parent_obj_id
238     with  property  value,
239           property  value,
240           ...
241           property  value,
242     has   attribute  attribute  ... attribute;
243
244   Release  expression;
245
246   Replace  routine_id;
247
248   Serial "yymmdd";
249
250   Verb  'verb'
251       * token  token  ...  token -> action
252       * token  token  ...  token -> action
253       ...
254       * token  token  ...  token -> action;
255
256   ! comment text which the compiler ignores
257
258   [ routine_id;  statement;  statement; ... statement;  ];
259
260   #Ifdef  any_id;  ... #Endif;
261
262 Directives that we've not met
263 -----------------------------
264
265 There's only a handful of useful directives which we haven't needed to 
266 use::
267
268   Attribute attribute;
269
270   Global var_id;
271   Global var_id = expression;
272
273   Property property;
274
275   Statusline score;
276   Statusline time;
277
278 but there's a whole load which are of fairly low importance for now::
279
280   Abbreviate
281   Array
282   Default
283   End
284   Ifndef
285   Ifnot
286   Iftrue
287   Iffalse
288   Import
289   Link
290   Lowstring
291   Message
292   Switches
293   System_file
294   Zcharacter
295
296 .. _objects:
297
298 Objects
299 =======
300
301 An object is really just a collection of variables which together 
302 represent the capabilities and current status of some specific component 
303 of the model world. Full variables are called properties; simpler 
304 two-state variables are attributes.
305
306 Properties
307 ----------
308
309 .. Generated by autoindex
310 .. index::
311    pair: before; library property
312    pair: name; library property
313
314 The library defines around forty-eight standard property variables (such 
315 as :prop:`before` or :prop:`name`), but you can readily create further ones just 
316 by using them within an object definition.
317
318 You can create and initialise a property in an object's ``with`` segment:
319
320   property,                             ! set to zero / false
321
322   property value,                       ! set to a single value
323
324   property value value ... value,       ! set to a list of values
325
326 In each case, the `{value}` is either a compile-time `{expression}`, or 
327 an embedded routine::
328
329   property expression,
330
331   property [; statement; statement; ... statement; ],
332
333 You can refer to the value of a property::
334
335   self.property                         ! only within that same object
336
337   obj_id.property                       ! everywhere
338
339 and you can test whether an object definition includes a given property::
340
341   (obj_id provides property)            ! is true or false
342
343 .. _routines:
344
345 Routines
346 ========
347
348 Inform provides standalone routines and embedded routines.
349
350 Standalone routines
351 -------------------
352
353 Standalone routines are defined like this::
354
355   [ routine_id; statement; statement; ... statement; ];
356
357 and called like this::
358
359   routine_id()
360
361 Embedded routines
362 -----------------
363
364 These are embedded as the value of an object's property::
365
366   property [; statement; statement; ... statement; ],
367
368 and are usually called automatically by the library, or manually by::
369
370   self.property()                       ! only within that same object
371
372   obj_id.property()                     ! everywhere
373
374 .. index::
375    single: arguments (of a routine)
376
377 Arguments and local variables
378 -----------------------------
379
380 Both types of routine support up to fifteen local variables -- variables 
381 which can be used only by the statements within the routine, and which 
382 are automatically initialised to zero every time that the routine is 
383 called::
384
385   [ routine_id var_id var_id ... var_id; statement; statement; ... statement; ];
386
387   property [ var_id var_id ... var_id; statement; statement; ... statement; ],
388
389 You can pass up to seven arguments to a routine, by listing those 
390 arguments within the parentheses when you call the routine. The effect 
391 is simply to initialise the matching local variables to the argument 
392 values rather than to zero::
393
394   routine_id(expression, expression, ... expression)
395
396 Although it works, this technique is rarely used with embedded routines, 
397 because there is no mechanism for the library to supply argument values 
398 when calling the routine.
399
400 Return values
401 -------------
402
403 Every routine returns a single value, which is supplied either 
404 explicitly by some form of return statement::
405
406   [ routine_id; statement; statement; ... return expr; ]; ! returns expr
407
408   property [; statement; statement; ... return expr; ], ! returns expr
409
410 or implicitly when the routine runs out of statements. If none of these
411 ``statements`` is one -- ``return``, ``print_ret``, ``"..."`` or
412 ``<<...>>`` -- that causes an explicit return, then::
413
414   [ routine_id; statement; statement; ... statement; ];
415
416 .. Generated by autoindex
417 .. index::
418    pair: true; library constant
419
420 returns :const:`true` and ::
421
422   property [; statement; statement; ... statement; ]
423
424 return :const:`false`.
425
426 This difference is *important*. Remember it by the letter pairs STEF: 
427 left to themselves, Standalone routines return True, Embedded routines 
428 return False.
429
430 Here's an example standalone routine which returns the larger of its two
431 argument values::
432
433   [ Max a b; if (a > b) return a; else return b; ];
434
435 and here are some examples of its use (note that the first example, 
436 though legal, does nothing useful whatsoever)::
437
438   Max(x,y);
439
440   x = Max(2,3);
441
442   if (Max(x,7) == 7) ...
443
444   switch (Max(3,y)) { ...
445
446 Library routines versus entry points
447 ------------------------------------
448
449 A library routine is a standard routine, included within the library 
450 files, which you can optionally call from your source file if you 
451 require the functionality which the routine provides. We've mentioned 
452 these library routines::
453
454   IndirectlyContains(parent_obj_id, obj_id)
455
456   PlaceInScope(obj_id)
457
458   PlayerTo(obj_id, flag)
459
460   StartDaemon(obj_id)
461
462   StopDaemon(obj_id)
463
464
465 By contrast, an entry point routine is a routine which you can provide 
466 in your source file, in which case the library calls it at an 
467 appropriate time. We've mentioned these optional entry point routines::
468
469   DeathMessage()
470
471   InScope(actor_obj_id)
472
473 And this, the only mandatory one::
474
475   Initialise()
476
477 There are full lists in :ref:`library-routines` and :ref:`entry-points`.
478
479 .. _reading-other-code:
480
481 Reading other people's code
482 ===========================
483
484 Right at the start of this guide, we warned you that we weren't setting 
485 out to be comprehensive; we've concentrated on presenting the most 
486 important aspects of Inform, as clearly as we can. However, when you 
487 read the *Inform Designer's* Manual, and more especially when you look 
488 at complete games or library extensions which other designers have 
489 produced, you'll come across other ways of doing things -- and it might 
490 be that you, like other authors, prefer them over our methods. Just try 
491 to find a style that suits you and, this is the important bit, be 
492 *consistent* about its use. In this section, we highlight some of the 
493 more obvious differences which you may encounter.
494
495 Code layout
496 -----------
497
498 Every designer has his or her own style for laying out their source 
499 code, and they're all worse than the one you adopt. Inform's flexibility 
500 makes it easy for designers to choose a style that suits them; 
501 unfortunately, for some designers this choice seems influenced by the 
502 Jackson Pollock school of art. We've advised you to be consistent, to 
503 use plenty of white space and indentation, to choose sensible names, to 
504 add comments at difficult sections, to actively *think*, as you write 
505 your code, about making it as readable as you can.
506
507 This is doubly true if you ever contemplate sharing a library extension 
508 with the rest of the community. This example, with the name changed, is 
509 from a file in the Archive::
510
511   [xxxx i j;
512   if (j==0) rtrue;
513   if (i in player) rtrue;
514   if (i has static || (i has scenery)) rtrue;
515   action=##linktake;
516   if (runroutines(j,before) ~= 0 || (j has static || (j has scenery))) {
517   print "You'll have to disconnect ",(the) i," from ",(the) j," first.^";
518   rtrue;
519   }
520   else {
521   if (runroutines(i,before)~=0 || (i has static || (i has scenery))) {
522   print "You'll have to disconnect ",(the) i," from ",(the) j," first.^";
523   rtrue;
524   }
525   else
526   if (j hasnt concealed && j hasnt static) move j to player;
527   if (i hasnt static && i hasnt concealed) move i to player;
528   action=##linktake;
529   if (runroutines(j,after) ~= 0) rtrue;
530   print "You take ",(the) i," and ",(the) j," connected to it.^";
531   rtrue;
532   }
533   ];
534
535 Here's the same routine after a few minutes spent purely on making it 
536 more comprehensible; we haven't actually tested that it (still) works, 
537 though that second ``else`` looks suspicious::
538
539   [ xxxx i j;
540       if (i in player || i has static or scenery || j == nothing) return true;
541       action = ##LinkTake;
542       if (RunRoutines(j,before) || j has static or scenery)
543           "You'll have to disconnect ", (the) i, " from ", (the) j, " first.";
544       else {
545           if (RunRoutines(i,before) || i has static or scenery)
546               "You'll have to disconnect ", (the) i, " from ", (the) j, " first.";
547           else
548               if (j hasnt static or concealed) move j to player;
549           if (i hasnt static or concealed) move i to player;
550           if (RunRoutines(j,after)) return true;
551           "You take ", (the) i, " and ", (the) j, " connected to it.";
552       }
553   ];
554
555 We hope you'll agree that the result was worth the tiny extra effort. 
556 Code gets written once; it gets read dozens and dozens of times.
557
558 Shortcuts
559 ---------
560
561 There are a few statement shortcuts, some more useful than others, which 
562 you'll come across.
563
564 * These five lines all do the same thing::
565
566     return true;
567     return 1;
568     return;
569     rtrue;
570     ];          ! at the end of a standalone routine
571
572 * These four lines all do the same thing::
573
574     return false;
575     return 0;
576     rfalse;
577     ];          ! at the end of an embedded routine
578
579 * These four lines all do the same thing::
580
581     print "string"; new_line; return true;
582     print "string^"; return true;
583     print_ret "string";
584     "string";
585
586 * These lines are the same::
587
588     print value1; print value2; print value3;
589     print value1, value2, value3;
590
591 * These lines are the same::
592
593     <action noun second>; return true;
594     <<action noun second>>;
595
596 * These lines are also the same::
597
598     print "^";
599     new_line;
600
601 * These ``if`` statements are equivalent::
602
603     if (MyVar == 1 || MyVar == 3 || MyVar == 7) ...
604
605     if (MyVar == 1 or 3 or 7) ...
606
607 * These ``if`` statements are equivalent as well::
608
609     if (MyVar ~= 1 && MyVar ~= 3 && MyVar ~= 7) ...
610     if (MyVar ~= 1 or 3 or 7) ...
611
612 * In an ``if`` statement, the thing in parentheses can be *any* 
613   expression; all that matters is its value: zero (false) or anything 
614   else (true). For example, these statements are equivalent::
615
616     if (MyVar ~= false) ...
617     if (~~(MyVar == false)) ...
618     if (MyVar ~= 0) ...
619     if (~~(MyVar == 0)) ...
620     if (MyVar) ...
621
622   Note that the following statement specifically tests whether ``MyVar`` 
623   contains :const:`true` (1), *not* whether its value is anything other than 
624   zero. ::
625
626     if (MyVar == true) ...
627
628 * If ``MyVar`` is a variable, the statements ``MyVar++;`` and 
629   ``++MyVar;`` work the same as ``MyVar = MyVar + 1;`` For example, 
630   these lines are equivalent::
631
632     MyVar = MyVar + 1; if (MyVar == 3) ...
633     if (++MyVar == 3) ...
634     if (MyVar++ == 2) ...
635
636   What's the same about ``MyVar++`` and ``++MyVar`` is that they both 
637   add one to ``MyVar``. What's different about them is the value to 
638   which the construct itself evaluates: ``MyVar++`` returns the current 
639   value of ``MyVar`` and then performs the increment, whereas 
640   ``++MyVar`` does the "+1" first and then returns the incremented 
641   value. In the example, if ``MyVar`` currently contains 2 then 
642   ``++MyVar`` returns 3 and ``MyVar++`` returns 2, even though in both 
643   cases the value of ``MyVar`` afterwards is 3. As another example, 
644   this code (from Helga in "William Tell")::
645
646     Talk: self.times_spoken_to = self.times_spoken_to + 1;
647         switch (self.times_spoken_to) {
648             1: score = score + 1;
649                print_ret "You warmly thank Helga for the apple.";
650             2: print_ret "~See you again soon.~";
651             default: return false;
652         }
653     ],
654
655   could have been written more succinctly like this::
656
657     Talk: switch (++self.times_spoken_to) {
658         1: score++;
659            print_ret "You warmly thank Helga for the apple.";
660         2: print_ret "~See you again soon.~";
661         default: return false;
662         }
663     ],
664
665 * Similarly, the statements ``MyVar--;`` and ``--MyVar;`` work the same 
666   as ``MyVar = MyVar - 1;`` Again, these lines are equivalent::
667
668     MyVar = MyVar - 1; if (MyVar == 7) ...
669     if (--MyVar == 7) ...
670     if (MyVar-- == 8) ...
671
672 "number" property and "general" attribute
673 -----------------------------------------
674
675 .. Generated by autoindex
676 .. index::
677    pair: general; library attribute
678    pair: number; library property
679
680 The library defines a standard :prop:`number` property and a standard 
681 :attr:`general` attribute, whose roles are undefined: they are 
682 general-purpose variables available within every object to designers as 
683 and when they desire.
684
685 We recommend that you avoid using these two variables, primarily because 
686 their names are, by their very nature, so bland as to be largely 
687 meaningless. Your game will be clearer and easier to debug if you 
688 instead create new property variables -- with appropriate names -- as 
689 part of your ``Object`` and ``Class`` definitions.
690
691 .. _common-props:
692
693 Common properties and attributes
694 --------------------------------
695
696 As an alternative to creating new individual properties which apply only to
697 a single object (or class of objects), it's possible to devise properties
698 and new attributes which, like those defined by the library, are available
699 on *all* objects. The need to do this is actually quite rare, and is mostly
700 confined to library extensions (for example, the ``pname.h`` extension
701 which we encountered in :doc:`12` gives every object a ``pname`` property
702 and a ``phrase_matched`` attribute). To create them, you would use these
703 directives near the start of your source file::
704
705   Attribute attribute;
706
707   Property property;
708
709 We recommend that you avoid using these two directives unless you really 
710 do need to affect every object -- or at least the majority of them -- in 
711 your game. There is a limit of forty-eight attributes (of which the 
712 library currently defines around thirty) and sixty-two of these common 
713 properties (of which the library currently defines around forty-eight). 
714 On the other hand, the number of individual properties which you can add 
715 is virtually unlimited.
716
717 .. _setting-up-tree:
718
719 Setting up the object tree
720 --------------------------
721
722 .. Generated by autoindex
723 .. index::
724    pair: found_in; library property
725
726 Throughout this guide, we've defined the initial position of each object 
727 within the overall object tree either by explicitly mentioning its 
728 parent's ``obj_id`` (if any) in the first line of the object definition 
729 -- what we've been calling the header information -- or, for a few 
730 objects which crop up in more than one place, by using their 
731 :prop:`found_in` properties. For example, in "William Tell" we defined 
732 twenty-seven objects; omitting those which used :prop:`found_in` to define 
733 their placement at the start of the game, we're left with object 
734 definitions starting like this::
735
736   Room    street "A street in Altdorf"        
737
738   Room    below_square "Further along the street"
739   Furniture   stall "fruit and vegetable stall" below_square
740   Prop    "potatoes" below_square
741   Prop    "fruit and vegetables" below_square
742   NPC     stallholder "Helga" below_square
743
744   Room    south_square "South side of the square"
745
746   Room    mid_square "Middle of the square"
747   Furniture   pole "hat on a pole" mid_square
748
749   Room    north_square "North side of the square"
750
751   Room    marketplace "Marketplace near the square"
752   Object  tree "lime tree" marketplace
753   NPC     governor "governor" marketplace
754
755   Object  bow "bow"
756
757   Object  quiver "quiver"
758   Arrow   "arrow" quiver
759   Arrow   "arrow" quiver
760   Arrow   "arrow" quiver
761
762   Object  apple "apple"
763
764 You'll see that several of the objects begin the game as parents: 
765 ``below_square``, ``mid_square``, ``marketplace`` and ``quiver`` all 
766 have child objects beneath them; those children mention their parent as 
767 the last item of header information.
768
769 There's an alternative object syntax which is available to achieve the 
770 same object tree, using "arrows". That is, we could have defined those 
771 parent-and-child objects as::
772
773   Room    below_square "Further along the street"
774   Furniture -> stall "fruit and vegetable stall"
775   Prop      -> "potatoes"
776   Prop      -> "fruit and vegetables"
777   NPC       -> stallholder "Helga"
778
779   Room      mid_square "Middle of the square"
780   Furniture   -> pole "hat on a pole"
781
782   Room      marketplace "Marketplace near the square"
783   Object    -> tree "lime tree"
784   NPC       -> governor "governor"
785
786   Object    quiver "quiver"
787   Arrow     -> "arrow"
788   Arrow     -> "arrow"
789   Arrow     -> "arrow"
790
791 The idea is that an object's header information *either* starts with an 
792 arrow, or ends with an ``obj_id``, or has neither (having both isn’t 
793 permitted). An object with neither has no parent: in this example, 
794 that's all the ``Rooms``, and also the ``bow`` and the ``quiver`` (which 
795 are moved to the player ``object`` in the ``Initialise`` routine) and 
796 the apple (which remains without a parent until Helga gives it to 
797 William).
798
799 An object which starts with a single arrow ``->`` is defined to be a 
800 child of the nearest previous object without a parent. Thus, for 
801 example, the ``tree`` and ``governor`` objects are both children of the 
802 ``marketplace``. To define a child of a child, you'd use two arrows
803 ``-> ->``, and so on. In "William Tell", that situation doesn't occur; 
804 to illustrate how it works, imagine that at the start of the game the 
805 potatoes and the other fruit and vegetables where actually *on* the 
806 stall. Then we might have used::
807
808   Room    below_square "Further along the street"
809   Furniture ->  stall "fruit and vegetable stall"
810   Prop    ->  -> "potatoes"
811   Prop    ->  -> "fruit and vegetables"
812   NPC     -> stallholder "Helga"
813   ...
814
815 That is, the objects with one arrow (the ``stall`` and ``stallholder``) 
816 are children of the nearest object without a parent (the ``Room``), and 
817 the objects with two arrows (the produce) are children of the nearest 
818 object defined with a single arrow (the ``stall``).
819
820 The advantages of using arrows include:
821
822 * You're forced to define your objects in a "sensible" order.
823
824 * Fewer ``obj_ids`` may need to be used (though in this game it would 
825   make no difference).
826
827 The disadvantages include:
828
829 * The fact that objects are related by the physical juxtaposition of 
830   their definitions is not necessarily intuitive to all designers.
831
832 * Especially in a crowded room, it’s harder to be certain exactly how 
833   the various parent–child relationships are initialised, other than by 
834   carefully counting lots of arrows.
835
836 * If you relocate the parent within the initial object hierarchy to a 
837   higher or lower level, you'll need also to change its children by 
838   adding or removing arrows; this isn't necessary when the parent is 
839   named in the child headers.
840
841 We prefer to explicitly name the parent, but you'll encounter both forms 
842 very regularly.
843
844 Quotes in "name" properties
845 ---------------------------
846
847 We went to some lengths, way back in :ref:`things-in-quotes`, to explain
848 the difference between double quotes ``"..."`` (strings to be output) and
849 single quotes ``'...'`` (input tokens -- dictionary words).  Perhaps
850 somewhat unfortunately, Inform allows you to blur this clean distinction:
851 you can use double quotes in name properties and Verb directives::
852
853   NPC     stallholder "Helga" below_square
854     with  name "stallholder" "greengrocer" "monger" "shopkeeper" "merchant"
855               "owner" "Helga" "dress" "scarf" "headscarf",
856   ...
857
858   Verb "talk" "t//" "converse" "chat" "gossip"
859       * "to"/"with" creature          -> Talk
860       * creature                      -> Talk;
861
862 *Please* don't do this. You'll just confuse yourself: those are 
863 dictionary words, not strings; it's just as easy -- and far clearer -- 
864 to stick rigidly to the preferred punctuation.
865
866 Obsolete usages
867 ---------------
868
869 Finally, remember that Inform has been evolving since 1993. Over that 
870 time, Graham has taken considerable care to maintain as much 
871 compatibility as possible, so that games written years ago, for earlier 
872 versions of the compiler and the library, will still compile today. 
873 While generally a good thing, this brings the disadvantage that a 
874 certain amount of obsolete baggage is still lying around. You may, for 
875 example, see games using ``Nearby`` directives (denotes parentage, 
876 roughly the same as ``->``) and ``near`` conditions (roughly, having the 
877 same parent), or with ``" \ "`` controlling line breaks in long 
878 ``print`` statements. Try to understand them; try *not* to use them.