AltScript vs Rebol

AltScript is derived from Rebol, but it is not directly compatible with it.

The Rebol Language was introduced in 1999 by Carl Sassenrath, the computer architect known for bringing multitasking to personal computers. (Amiga Computer, circa 1985)

Rebol is unique and powerful in many ways. Over a couple years it gained momentum with millions of downloads and half a dozen books published about it. Unfortunately, Rebol was closed source, and with so many open source languages, it lost most of its user-base.

AltScript and its ASON source format are similar to Rebol, but there are important differences:

  • Braces {} are used to denote objects. They are lexical and may be used directly without evaluation (the make constructor is not necessary).
  • Braces {} are not used for multi-line strings. A single+double quote format is used for multi-line strings.
  • All loaded values are constant by default. This includes strings, blocks, and objects. They are all protected from modification. However, they can be copied and modified. In addition, they can be loaded as modifiable by using a load option.
  • Zero-based indexing is used for blocks (arrays). This is consistent with many other languages.
  • Dots are used for field selection. For example, “person.name” refers to the name field of the person object. Slashes are not used for selection. Use of a dot for selection is common in many other languages.
  • The at sign “@” denotes literal values for none, true, false, data-types, and special values like NAN (not a number).
  • Short strings are stored directly in value cells, not in separate storage. This is an space-saving optimization.
  • Characters are expressed as strings. The above storage optimization makes this possible.
  • Binary (byte arrays) use #”…” for hex and ##”…” for base-64.
  • Base-2 binary is not directly expressible in source format.
  • Arithmetic operators can be used on series data-types (strings and blocks) for various useful results. For example “+” can be used to join strings and blocks.
  • String character escapes use C notation. They use backslash notation, for example “\n” for newline and “\t” for tab.
  • The #{ and #[ sequences are reserved for future use. Currently they are undefined.
  • For JSON compatiblity:
    • Keys (word definitions) can be written with quotes (“field”:)
    • A lone colon (:) will automatically associate to the word/string immediately before it.
    • Commas as element separators are allowed as long as they are not directly followed by a non-digit character (to avoid confusion with comma-based decimal values.)

list of differences