Jump to content

Rebol Programming/protect-system

From Wikibooks, open books for an open world

USAGE:

[edit | edit source]
PROTECT-SYSTEM 

DESCRIPTION:

[edit | edit source]

Protects all system functions and the system object from redefinition.

PROTECT-SYSTEM is a function value.

SOURCE CODE

[edit | edit source]
protect-system: func [
    {Protects all system functions and the system object from redefinition.} 
    /local vals words word
][
    vals: second system/words 
    words: make block! 1 
    foreach word first system/words [
        if any-function? first vals [append words word] 
        vals: next vals
    ] 
    foreach word bind words 'read [protect word] 
    protect 'system
]