Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Replacing placeholders?

From: tim-johnsons:web at: 9-Aug-2007 12:07

On Wednesday 08 August 2007, Kai Peters wrote:
> Tim ~ > > my "overshadowing" assumption was wrongly based on output below >
Rebol's approach to scope can be problematic, especially in large applications. Example: ;; global value (not inside of a function) username: "Kai" ;; used for all kinds of things in large application scopekiller: func[uname[string!] /local user][ username: uname ;; OOPS! typo with unpredicable consequences ] scopekiller "Tim" ;; username is now me :-) This is where 'protect can be your friend. username: "Kai" protect 'username and: ;;use 'unprotect before resetting a 'protect'ed global word. unprotect 'username username: "Tim" ;;;;;;;;;;;;;; I also use global words as part of an object, this has a tendency to lessen typos. glbs: context[unsername: "Kai"] glbs/username: "Tim" tim