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 :-) ei: a: 5 b: a in this example, b is a reference to a (right?). 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? Rishi Previously, you ([EMAIL PROTECTED]) wrote: > Hi Rishi > > Well, there are a lot of issues raised by your questions. I am sure you will > get a number of responses. I will limit myself to a couple of quick > comments. > > In many ways REBOL is closely related to the Scheme language. > > 1) In the Scheme community, pass-by-value means the arguments to a function > are evaluated by the interpreter before the function is called. This is true > of REBOL as well. > > 2) In Scheme, all (well almost all) values are (at least conceptually) > pointers (references). So an arg may be evaluated, but the value is a > pointer. REBOL is similar, but more complicated. > > In Rebol, if a function has a string or block argument, the argument is > evaluated before the function is called. But strings and blocks evaluate to > themselves. In the case of blocks, the words within the block and > recursively in all nested blocks are added to the symbol global table by the > interpreter before the function is called, but no further processing is > done. The block is then assigned to the local word defined in the function > spec which is in the symbol table local to the function. > > But what is really passed into the function and assigned to the local arg > word is a pointer to the string or block. > > Here is a short example which illustrates this behavior. > > >> s: "abcdef" > == "abcdef" > >> f: func [x][remove x] > >> f s > == "bcdef" > >> s > == "bcdef" > >> b: [1 2 3] > == [1 2 3] > >> f b > == [2 3] > >> b > == [2 3] > >> > >> x ;x is a word local to the function f > ** Script Error: x has no value. > ** Where: x > > Notice that modifying the block or string referenced by the local variable > x, also changes the original global value. To prevent that you would have to > use COPY to create a new copy either in the function call or within the > function itself. > > HTH > -Larry > > ----- Original Message ----- > From: <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, October 09, 2000 11:55 AM > Subject: [REBOL] generalities of addresses and values... > > > > I'm a bit confused on how references work in Rebol. I wish there was a > chapter in the rebol core manual dedicated on this alone. Perhaps someone > could comment the general way addresses and values work in Rebol. > > > > Here is how I currently think it works...please correct me if I'm wrong. > > > > -all one-level series are passed/copied/attached by value. > > -all one-level objects are passed/copied/attached by value. > > -all one-level functions are passed/copied/attached by value. > > -all datatypes other than objects, series, and functions are > passed/copied/attached by value. > > > > -all deep series are passed/copied/attached by reference. > > -all deep functions (functions within functions or blocks within > functions) are passed/copied/attached by reference. > > -all deep objects (objects within objects or blocks within objects) are > passed/copied/attached by reference. > > > > did I miss anything? > > > > Rishi > > > >