Keywords: onyx

Next: 1.3 Execution Up: 1. Onyx Language Tutorial Previous: 1.1 Syntax Contents Index

# 1.2 Data types

Onyx includes a rich set of data types. In fact, Onyx code is represented as data, which means that there is a whole range of possibilities when writing Onyx programs that are difficult or impossible with compiled languages such as C. This aspect of Onyx is discussed in Section 1.10.

Onyx is dynamically typed, which means that errors due to object type incompatibilities are detected during program execution. For example, the following code will always run without an error, even though the arguments that would be passed to the add operator are invalid.

    false {
        `a string' [1] add
    }{
        `This is always printed' 1 sprint
    } ifelse

Dynamic typing has advantages in the flexibility that it offers, but it also means that type errors can go undetected in code for long periods of time before the invalid code is executed.

Onyx has a fixed set of basic types which cannot be extended. However, object-oriented programming is supported, so the fixed set of object types is not a limitation in practice. Object-oriented programming is discussed more in Section 2.10.

Next: 1.3 Execution Up: 1. Onyx Language Tutorial Previous: 1.1 Syntax Contents Index