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

[REBOL] [hints] HELP & "reserved words" (was: Another Console Related Question)

From: greggirwin::mindspring::com at: 29-Apr-2004 10:29

Hi Paul, Two more hints for you. pbc> ...Since, as Arie was kind enough to point out, "clear" is a pbc> reserved word in Rebol I changed it to "cls" so that it is now pbc> cls: does [prin "^L"]. The important one is HELP; i.e. the HELP function in REBOL. If you aren't sure whether a word has been defined, try using HELP to find it. You can also use datatypes with help. It's darn handy. Try some of these for fun. help clear help cl help tuple! help object! help function! help to- You won't always find answers this way, but you can find out a lot about REBOL. The view-ref reblet on the View desktop and the dictionary HTML file are other great ways to poke around. The other hint is a terminology thing that is important in the overall scheme of understanding REBOL. You said that CLEAR was a "reserved word", but that's not exactly true; there are *no* reserved words in REBOL. There are words that have been defined, and some of them are native! values (built-in kernel functions), but you can redefine *anything* in REBOL, as you've seen with CLEAR. You don't want to go around redefining IF, =, and other things just because you can, but you can if you need to. In this case, using CLS for your function name is a good choice, because it's a global thing I'm guessing. If you were writing a console dialect, then using CLEAR would probably be OK. In a dialect, it's the context that gives words their meaning, and if you put your dialect in a context (i.e. an object!), you can keep from messing with global words unintentionally. In closing, you might want to check this out: http://www.rebolforces.com/articles/tui-dialect/ Happy REBOLing! -- Gregg