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

[REBOL] Re: The truth about scope

From: gabriele:colellachiara at: 15-Apr-2005 19:47

Hi Michael, On Thursday, April 14, 2005, 8:17:01 PM, you wrote: MB> Hi Gabrielle, BTW, just one "l". ;-) MB> I just would like to make sure that I understood it correctly. One could MB> describe a simple example as follows: [...] To make things clearer: considering every word in the same context with the same spelling the same word would probably simplify this, but then you won't really need a "double pointer". The problem with "implementation details" and REBOL, is that we have no idea about what really is an implementation detail, and what is by design. What we know as been mostly obtained by experimenting on the current implementation. So, basically everything we know is an implementation detail. So I'll go into the details now, while still trying to give a simple explanation. The key concept in the implementation is the "value slot", which is basically 16 bytes of data (on 32 bit machines - there is no 64 bit version of REBOL currently so 16 bytes should be correct on all versions available). A value slot can contain completely the scalar values (i.e. integers, tuples, words, and so on); for series values, it contains a pointer to the actual sequence and an offset in the sequence (the position). (Note that LIST!s are different here.) A block is basically an array of value slots. A context is a table with "words" on the first column (probably it's not WORD! values, but you may safely assume so), and value slots on the second column. So, words will have a pointer to the value slot in the context. That value slot is what gets changed when you SET the value of a word. The pointer to the value slot is what changes when you BIND a word. Now, the reason for talking about "instances" is that the same word in two different value slots is two instances of the same word for me. If they are bound to the same context, they will point to the same value slot inside that context. If they are bound to different context, they aren't the same word anymore, and point to different value slots. I'm not sure if this helps, if you find it more confusing please ignore it completely. :) Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amiga Group Italia sez. L'Aquila --- SOON: