??ANSWER TO EXERCISE 57

Object -> "/?%?/ (the artiste formally known as Princess)"
  with name "princess" "artiste" "formally" "known" "as",
       short_name
       [;   if (self hasnt general) { print "Princess"; rtrue; }
       ],
       react_before
       [;  Listen: print_ret (name) self, " sings a soft siren song.";
       ],
       initial
       [;  print_ret (name) self, " is singing softly.";
       ],
       parse_name
       [ x n; if (self hasnt general)
            {   if (NextWord()=='princess') return 1;
                return 0;
            }
            x=WordAddress(wn);
            if (   x->0 == '/' && x->1 == '?' && x->2 == '%'
                && x->3 == '?' && x->4 == '/')
            {   while (wn<=parse->1 && WordAddress(wn++)<x+5) n++;
                return n;
            }
            return -1;
       ],
       life
       [;   Kiss: give self general; self.life = NULL;
                "In a fairy-tale transformation, the Princess 
                 steps back and astonishes the world by announcing 
                 that she will henceforth be known as ~/?%?/~.";
       ],
  has  animate proper female;

Back to the exercise in section 24
Mechanically translated to HTML from third edition as revised 16 May 1997. Copyright © Graham Nelson 1993, 1994, 1995, 1996, 1997: all rights reserved.