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

[REBOL] Re: Don't understand "try" and "disarm"

From: massung::gmail::com at: 15-Mar-2006 11:51

Something that might help a bit is to understand how symbols work internally. I'm going to describe this from the way Lisp does it (as I assume REBOL is the same, or just slightly modified). Regardless, the principle is the same and may help. Symbols (or words) do not have values. Instead, they are *bound* to values. It might help to think of this binding as an added level of indirection. If you were to implement a [crude] version of this in C++, it might looks something like this: enum value_type { VT_NUMBER, VT_STRING, VT_URL, VT_WORD, /* ... */ }; struct bind_slot { value_type type; void* value; }; map<string, bind_slot*> symbol_table; That bind_slot is important for several reasons: - a symbol can exist without being bound to anything - a symbol doesn't have a type - based on implementation, data doesn't have a type! Also, the bind_slots can act as a kind of reference. Two symbols can point to the same bind_slot. I think this is much easier to test around and play with in Lisp than in REBOL, but the priciples are the same. One important concept that REBOL can simulate, but doesn't have intrinsically, that I miss from Lisp is that of keywords. Keywords (in Lisp) are symbols that are bound to themselves. This is used for many things, but most commonly for enumerated values. HTH, Jeff M. -- massung-gmail.com On 3/15/06, Tim Johnson <tim-johnsons-web.com> wrote: