[REBOL] what if you squish one of your words? Re:
From: larry:ecotope at: 11-Aug-2000 18:05
Hi Galt
Well, it happens to the best of us, even Carl. Eric Long told me a great
story where a line of code he wrote redefined ALL of the system/words
including 'quit. Th simple answer is to put
protect-system
in your user.r file. It can be before or after any other words you define in
user.r. You will then get an error message if you attempt to redefine a
system word. You can still do so hwoever (system-protect is on)
>> print: 5
** Script Error: Word print is protected, cannot modify.
** Where: print: 5
>> print2: :print ;you can save the word in question
>> unprotect 'print ;unprotect the word
>> print: 5 ;redefine it
== 5
>> print ;the value of print is the integer 5
== 5
>> print: :print2 ;restore the value
>> protect 'print ;restore protection
>> print ;print works again
** Script Error: print is missing its value argument.
** Where: print
>> print: 5 ;and it's protected
** Script Error: Word print is protected, cannot modify.
** Where: print: 5
>>
I use system-protect although some experts feel they know all the
system/words well enough to make it unnecessary. With the new versions of
Core, View, and Command appearing frequently it is getting harder to keep
track mentally.
HTH
-Larry