what if you squish one of your words?
[1/3] from: galtbarber::mailandnews::com at: 11-Aug-2000 18:14
what if you make screw up like I did
the other day and kill one of your critical
key functions.
e.g.
first: "oh, well, it's only a vital rebol word!"
now, I can't get to the original value of the word 'first
to restore it. It is a native, and even if I
run another copy of rebol.exe to check out what it was
set to, I still don't know if there is a way to set it back.
Usually, it wouldn't matter, I suppose.
But occasionally you may be in the middle of
something you don't want to lose.
Is there any way to recover?
-Galt
p.s. I tried this, but it didn't work with a lot
of functions, including source or help which use first.
first: func [x][pick x 1]
I guess first is heavily overloaded.
I think it works differently with ports, too.
[2/3] 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
[3/3] from: galtbarber:mailandnews at: 14-Aug-2000 12:56
Thanks, Larry.
I just put protect-system in my user.r as you recommended.
-Galt