I don't see how this proves that b is not a reference to a. Take this function for 
example:



test: func [x y /in][
        either in [insert x y][x: y]
        print ["in test function: " x]
]

; #1
X: 5
print ["x: 5"]
test x 10
print ["after: " x]

;output for #1
x: 5
in test function:  10
after:  5

;;#1 here it seems like the number x is passed by value since original x is not 
modified


;#2
x: "hello"
print ["x: hello"]
test x "bye"
print x

;output for #2
x: hello
in test function:  bye
hello

;;#2 here it seems like the string x is passed by value since original string is not 
modified.


;#3
x: "hello"
print ["x: hello"]
test/in x "bye"
print x

;output for #3
x: hello
in test function:  byehello
byehello

;;#3 here I am totally baffled since in #2 it is passed by value, but here it is 
actually modifying original value. passed by reference. This seems to contradict what 
you (brett) said about 'b not being a reference of 'a. Example #3 shows that value in 
variable x is referenced.

Why is #2 passed by value and #3 passed by reference? This seem very inconsistent to 
me...but I'm sure reality is that I don't understand what is going on. It seemed to me 
that Larry implied that everything in rebol is passed by reference. but does not seem 
to be true as shown in above example. I don't know why this is so hard for me to 
grasp... It shouldn't be more complicated than c pointers!


Rishi



Previously, you ([EMAIL PROTECTED]) wrote:
> > ok. I think I get it now. Everything is basically done as a reference.
> Even setting words. This is much simpler than what I was thinking :-)
> 
> Um...
> 
> > a: 5
> > b: a
> >
> > in this example, b is a reference to a (right?).
> Nope. b is set with the result of evaluating a.
> 
> >> a: 5
> == 5
> >> b: a
> == 5
> >> a: 3
> == 3
> >> a
> == 3
> >> b
> == 5
> 
> > The thing that was confusing me was that the copy function doesn't always
> create a new copy. In deep series, it creates a reference to copied
> value....strange...
> >
> > By the way, is there any way to prove that b is a reference to a ( in the
> above example) ? I know you can do it if you set the value of as a series
> datatype (by using insert or other series function). But how do you prove
> that b references a for number datatypes?
> 
> I showed above that b is not a reference to a.
> 
> Here's another way to look at it.
> You could set the word "b" to have a value which is literally the word "a" -
> by doing this:
> 
> >> b: 'a
> == a
> 
> You could then see the value of the word "b" by
> >> get 'b
> == a
> 
> or evaluting b
> >> b
> == a
> 
> and combining
> >> get b
> == 3
> 
> Which evaluates b to a value, in this case a word, and then applies the get
> function to that value.
> 
> 

Reply via email to