next up previous
Next: Plain text and standard HTML inside pages
Up: The WOM language
Previous: How do attributes get their values?

Instances inside pages


Suppose we had a WOM source file, example.wom, which contained just two WOM elements and nothing else:

<TextField size=10 value="0">
<TextField size=11 value="1">
Then the compiler would translate it into a class of the form
::class example subclass Page public

  ::method init
    expose contents
    contents = .list~of(,

  ::method emit
    expose contents
    use arg output_stream
    do item over contents
      item~emit( output_stream )

The idea is that when an instance of the page is created, it initialises itself with a list containing one instance of each TextField. When the page instance is asked to emit itself, it runs over its contents asking these fields to do the same.

Jocelyn Ireson-Paine
Fri May 30 14:03:06 BST 1997