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

[REBOL] generalities of addresses and values... Re:(4)

From: rishi:picostar at: 10-Oct-2000 22:29

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 ([brett--codeconscious--com]) wrote: