Skip to content

Namespaces

The syntax for a namespace is as follows:

style
namespace_name {
    -- ... (the namespace body)
}

Refer to this section for a detailed explanation of what may appear in the body of a namespace.

Values declared within a namespace can be read outside of the namespace using the "dot" operator:

style
namespace_name.field_name

Hence they are also called global variables. Overwriting these values is not allowed.

Canvas Preamble Block

Each Style program must contain a canvas preamble block, a special type of namespace which describes the width and height of the canvas. For example, preamble block

style
canvas {
    width = 800
    height = 700
}

tells Penrose that the drawing canvas should have a width of 800 pixels and a height of 700 pixels.

Released under the MIT License.