next up previous
Next: Box naming and protection Up: The box Previous: Type converters

Selecting, creating, and destroying boxes

Boxes include a select operation, as shown before. It implements box lookup so that, given a box, inner boxes could be accessed.

When boxes are small enough, their containers can synthesize them on demand. A LATEX box might contain raw text, and create LATEX-section boxes on demand, as inner sections are selected to be copied and shared. Additional text in the document could be added by selecting an inner box past the end of the document (or before the start of the document).

The select operation is the only means for box creation. A new box is created by selecting a previously non-existing box. This usage of select subsumes the use of write to resize files, as well as the use of open to create files. Note that this can be done because boxes are more expressive than files; i.e. because they can represent pieces of data ranging from a whole application to a few bytes.

To give more intuition, (regarding selection) a box behaves like a directory with a set of entries corresponding to the set of selectors admitted by the box. This is another example of the superior expressiveness of boxes when compared to files, which require a complementary, different, abstraction (directories) to provide services which cannot be expressed with only regular files.

A selector is a string given to select to specify which inner box is to be selected on a given box. Such string has a format which depends on the type of the box being selected (e.g. inner boxes within a LATEX box could be selected with selectors like ``section: the section title'', ``title'', ``author'', etc). As a given box can be compatible with more that one type (e.g. a LATEX box can also be seen as a text box, or as a character array box), it can admit more than one selector format (e.g. a text selector like ``lines: 50-100'' and a character selector like ``char: 500-4000'' can also be used when selecting within our LATEX box).

Note how by means of select, box contents no longer need to be a simple and contiguous piece of data. Box contents are seen by users as the set of inner boxes which could be selected. Such contents can be continuous or discrete, compact or sparse, depending on the type of box.

Box destruction is achieved by a combination of select and copy. First, the box to be destroyed is selected; second, a special (system provided) anti-box is copied into the box being destroyed. The box implementation considers a copy from the anti-box as an request for self-destruction. The intuition behind is that the anti-box is to a box what anti-matter is to matter. By using such artifact, a new (delete) operation is avoided.


next up previous
Next: Box naming and protection Up: The box Previous: Type converters

1999-02-26