home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / APPS / lout2.lzh / LOUT2 / DOC / TR.IMPL / s2.1 < prev    next >
Text File  |  1994-01-25  |  4KB  |  88 lines

  1. @SubSection
  2.     @Tag { genesis }
  3.     @Title { The genesis of the object abstraction }
  4. @Begin
  5. @PP
  6. When one examines previous document formatting systems [4]
  7. looking for ideas for abstractions, as the author did in 1984, the Eqn
  8. formatting language [5] stands out like a beacon.  In
  9. Eqn, a mathematical formula such as 
  10. @ID @Eq { { x sup 2 + 1 } over 4 }
  11. is produced by typing
  12. @ID @Code "{ x sup 2 + 1 } over 4"
  13. in the input file; @Code sup and @Code over are binary operators, and
  14. braces are used for grouping.  This is document formatting at a very
  15. high level, close to the language of mathematics itself, with all
  16. reference to font changes and spacing suppressed.
  17. @PP
  18. Eqn provides a single data type (let us call it the {@I expression}),
  19. built up recursively in context-free style:  where one expression may appear,
  20. any expression may appear.  This approach is common in algebra and
  21. programming languages, where its simplicity and expressiveness have long
  22. been appreciated; but Eqn was the first language to demonstrate its
  23. utility in document formatting.
  24. @PP
  25. Each expression is treated by Eqn as a rectangle with a
  26. {@I {horizontal axis}}, used for alignment with adjacent expressions:
  27. @ID @ShowMarks marks { horizontal } @Eq { { x sup 2 + 1 } over 4 }
  28. The size and rendering of the expression on the printed page are
  29. known only to the implementation, never explicitly calculated or
  30. accessed by the user.  This prohibition is
  31. crucial to the maintenance of the context-free property in practice.  In
  32. Lout, for example, equations, figures, tables, and arbitrary objects may
  33. be mixed together freely.  This would be impossible if size information
  34. was hidden from the implementation in user calculations.
  35. @PP
  36. The object abstraction of Lout is a direct descendant of the Eqn
  37. expression.  It employs the same context-free recursive style of construction,
  38. and each object is treated by Lout as a rectangle:
  39. @ID @Fig {
  40. @ShowMarks { 1c @Wide ^| 2c @Wide 0.45c @High ^/ 0.35c @High }
  41. }
  42. The horizontal axis, called a @I { row mark } in Lout, has a
  43. vertical analogue called a {@I {column mark}}, creating a valuable
  44. symmetry between horizontal and vertical.  Multiple column and row marks
  45. are permitted:
  46. @ID @Fig {
  47. A:: @Box margin { 0c } paint { grey } { 1.2c @Wide 0.8c @High }
  48. |1c
  49. B:: @Box margin { 0c } paint { grey } { 1c @Wide 0.8c @High }
  50. /0.5c
  51. C:: @Box margin { 0c } paint { grey } { 0.7c @Wide 0.8c @High }
  52. |1c
  53. D:: @Box margin { 0c } paint { grey } { 1.3c @Wide 0.8c @High }
  54. // @Line linestyle { dashed }
  55.      from { A@W -- { 0.3 cm 0 } }
  56.      to   { B@W ++ { 1.6 cm 0 } }
  57. // @Line linestyle { dashed }
  58.      from { C@W -- { 0.3 cm 0 } }
  59.      to   { D@W ++ { 1.6 cm 0 } }
  60. // @Line linestyle { dashed }
  61.      from { A@NW ++ { 0 0.3 cm } }
  62.      to   { C@SW -- { 0 0.3 cm } }
  63. // @Line linestyle { dashed }
  64.      from { B@NW ++ { 0.3 cm 0.3 cm } }
  65.      to   { D@SW ++ { 0.3 cm -0.3 cm } }
  66. }
  67. so that objects are able to represent tables.
  68. @PP
  69. This abstraction has some limitations, the most obvious being the restriction
  70. of size calculations to rectangular bounding boxes.  Non-rectangular and
  71. disconnected shapes arise naturally in figures and in the characters of
  72. fonts; the extension to them is conceptually straightforward and might
  73. help to explain some fine points of layout such as kerning.  However,
  74. there are implementation and language design problems, particularly
  75. when filling non-rectangular shapes with text, and so the author chose
  76. to keep to Eqn's rectangles.
  77. @PP
  78. A more fundamental limitation of the object abstraction arises from the
  79. inability of recursive data types to describe cross-linked structures,
  80. which seem to require some means of naming the multiply referenced
  81. parts.  Lout is obliged to introduce additional abstractions to cope
  82. with cross linking:  galleys for inserting text into pages
  83. (Section {@NumberOf galleys}), cross references (Section {@NumberOf cross}),
  84. and labelled points in figure drawing [6].  An
  85. abstraction closer to hypertext might form a more unified basis for
  86. these features.
  87. @End @SubSection
  88.