Hi Gabriele, (or whoever dares to read this :-) - I appologize for the  
length beforehand )

sorry for the wrong name, I should have seen it in the e-mail address.

I guess I got now the model correctly, also with the different views,  
which have come up during the thread.
I tried to create below some small showcase of how Rebol works, if I'm not  
too wrong that should be pretty all. If one adds evaluation of words and  
their different types, then this should be the basic components. Of course  
during evaluation things get much more complicated, but the basic issues  
should be like that.


1) - every Rebol object is somehow put into or referenced from a container  
(gets the name value-slot - for now)
    - a block is simply a list (however implemented) of value-slots
-------------------------------------------------------

e.g.
[1 "hallo" a] -> [(1) (|,1) (a)]
                        |     |
                        |   (unset!)
                        |
                       (h)-(a)-(l)-(l)-(o)

() = represents a value slot
(|,0) = a pointer to some other slot and with series position
(1) = value slot with native value
(a) = value slot with word which references a value slot

a: 5

[1 "hallo" a] -> [(1) (|,1) (a)]
                        |     |
                        |    (5)
                        |
                       (h)-(a)-(l)-(l)-(o)

2) words have a context, which is a mapping of words with different  
spelling to a value-slot (in the most extreme case just to one value-slot  
if every words referes to the same
------------------------------------------------

a: b: c: 1
d: next "hallo"

context-table:
word -- value-slot
a --\
b -- (1)
c --/
d -- (|,2)
       |
  (h)-(a)-(l)-(l)-(o)

3) creating new objects out of other object simply copies its value-slot
---------------------------------------------------------

a: 5
bl: [a 1 "hallo"]
bl2: []
append bl2 bl

bl ->  [(a) (1) (|,1)]
          |       |
         (5)      |
          |      (h)-(a)-(l)-(l)-(o)
          |       |
          |       |
bl2 -> [(a) (1) (|,1)]

4) binding a word to a new context simply changes the pointer to the  
value-slot of the word in the new context
-----------------------------------------------------------

a: 1
c: context [a: 5]
bl: [a]

global-context-table:
word -- value-slot
a -- (1)*
c -- (|)   ;references a block of dataelements
       |
       [(a:) (5)]
bl-- (|)
       |
       [(a)]
         |
        (1)*  ;is the same value-slot as in the context table, thus a is  
bound to global context

c-context-table:
word -- value-slot
a -- (5)***

binding 'a in the block 'bl to context of block attached to 'c

bind bl in c 'a

bl -> [(a)]
         |
        (5)***  ; bound to the context of the block attached to 'c

or via global context-table

global-context-table:
word -- value-slot
a -- (1)*
c -- (|)
       |
       [(a:) (5)]
bl-- (|)
       |
       [(a)]
         |
        (5)***  ; bound to the context of the block attached to 'c

5) obviously words with the same spelling in the same context reference  
the same value-slot
----------------------------------------------------------------------------

a: 1
bl: [a a]
c: context [a: 5]
append bl bind 'a in c 'a
append bl bind 'a in c 'a

bl -> [(a) (a) (a) (a)]
         \   /   \   /
          \ /     \ /
          (1)     (5)

global-context-table:
word -- value-slot
a -- (1)
bl-- .....
c -- .....

c-context-table:
word -- value-slot
a -- (5)


Maybe I was mainly so confused because the double pointer analogy is  
helpful only when one thinks of values as attached directly to words, then  
the indirection layer is needed, to make clear that it's just a place  
which is referenced. If one thinks like above then they are not necessary  
(as a desciption).

I stumbles over another interesting binding issue and I guess it also  
proves the above description (and what you wrote). E.g. why 'bind is not  
able to in-place bind a single word like

bl: [a b]
c: context [a: 5]
bind first bl in c 'a    ; the 'a in 'bl would be supposed to be bound to  
the context

This looks quite logical actually. The next would make less sense:

a: 2
a: 1
c: context [a: 5]
bind 'a in c 'a          ; Which 'a to bind?

But when one thinks about the code=data duality and thinks in value-slot  
terms, its logical that neither of the two examples above can work.

The first would look like:

(bl:) [(a) (b)]
(c:) (context) [(a:) (5)]
(bind) (first) (bl) (in) (c) ('a)

the last line reduces for evaluation to

(bind) (a) (in) (c) ('a)    ;just for this example, there happens more of  
course

So we got actually a word 'a in a value-slot and again there is no sense  
where 'a belongs to, it has no place.
On the opposite with a block we would have:

bl: [a]
c: context [a: 5]
bind bl in c 'a

->

(bl:) [(a)]
(c:) (context) [(a:) (5)]
(bind) (bl) (in) (c) ('a)
          |
          [(a)]  ; so we can change a word in a block, and only this word

So this time we have a word to reference (indirectly) and due to the  
reference character of blocks it will stay referenced (if we have a  
reference of course). In the first case because the value-slots are always  
copied when a new value-slot is created due to some action, it wouldn't  
work, because we can't keep a reference to a single particular word (there  
are no "instances" of words - as I understood it in a previous post and  
now has been clarified).


So thanks a lot for the patience.

:-)

Michael
-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to