Last modified on 3 June 2009, at 03:51

REBOL Programming/Internals

REBOL InternalsEdit

The System ObjectEdit

The System object is a very large object that contains most of the mezzanine code in REBOL, that is VID, the network protocols and system information about the REBOL product you are running.

Native FunctionsEdit

Native functions are functions that are hardwired into the kernel of REBOL. They can be considered low-level functions, that are designed for speed. A wide range of native functions exist.

You can reveal a native function in the console like this:

>> source insert
insert: native [
    {Inserts a value into a series and returns the series after the insert.} 
    series [series! port! bitset!] "Series at point to insert" 
    value [any-type!] "The value to insert" 
    /part "Limits to a given length or position." 
    range [number! series! port! pair!] 
    /only "Inserts a series as a series." 
    /dup "Duplicates the insert a specified number of times." 
    count [number! pair!]
]

The source code cannot be seen since the function is compiled into the REBOL interpreter kernel.

Mezzanine FunctionsEdit

Mezzanine functions are functions that are built on top of either native or other mezzanine functions. This means you can change them or build more functions on top of existing ones. REBOL has in all of its products many mezzanine functions built in.

They can be considered higher level functions, that are designed to provide ease of use, when coding your REBOL programs. The internet protocols in REBOL such as HTTP or POP3 are built as mezzanine functions.

When designing your own programs, you can build your own functions that blend in with the existing mezzanine functions, for example if you wish to extend REBOL with a new internet protocol.

Mezzanine functions are also special in that you can see the source code for them on the console like this:

>> source append
append: func [
    {Appends a value to the tail of a series and returns the series head.} 
    series [series! port!] 
    value 
    /only "Appends a block value as a block"
] [
    head either only [
        insert/only tail series :value
    ] [
        insert tail series :value
    ]
]