rebol2red-lang

Why is the word red a boolean variable?


red>> red
== true
red>> type? red
== logic!

Just curious to know why is red a boolean variable?

(perhaps unrelated) Side note: rebol in REBOL 2.7 console is of type object!.


Solution

  • It is defined in the "Red base environment definitions" file as

    Red: true ;-- ultimate Truth ;-) (pre-defines Red word)

    https://github.com/red/red/blob/9c355efa76ac1b5c17a8cbf359c5d7ab05a6a013/environment/scalars.red#L13

    This file contains other initial environment definitions such as:

    escape:      #"^["
    slash:       #"/"
    sp: space:   #" "
    ...
    

    As @kealist points out in the comment below, it serves a useful purpose:

    It stops the Red [] header in scripts from causing an error.

    In Rebol, the rebol word is bound to the system object so I expect the Red will follow a similar approach.