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

[REBOL] Re: link to background on Rebol language design?

From: nitsch-lists:netcologne at: 22-Aug-2003 22:11

Carl Read wrote:
>On 21-Aug-03, Gregg Irwin wrote: > >>Hi Bryan, et al >> > >>>>I've seen those from RT say that REBOL words are not variables, >>>>(as apposed to calling variables "words" just to be different >>>> > >>>This is nice, but if I have to communicate with someone not >>>with Rebol at all it seems most likely to me that they >>>Rebol Word as a variable, in fact, I've recently had >>> >>that situation, in b> order not to complicate matters too much it >> >>>something like: Rebol calls variables words, >>> >>or something similar. >> > >>From Core PDF: >> > >>"Words are the symbols used by REBOL. A word may or may not be a >>variable, depending on how it is used. Words are also used directly >>as symbols." >> > >>From REBOL in 10 Steps" >> > >>"Words are the symbols of REBOL. They are used to represent >>something directly as a word, or indirectly as a variable..." >> > >Yes - but that's just what RT says in their guides. ;) Compare with >this here... > > > >from Holgar Kruse... > >"I agree with Joel that, in order to become really adept at REBOL, you >have >to understand some of its concepts (values, references, NO variables >!, blocks, >contexts, words etc.), but then that is true for any language." > >Note the emphasized "NO" with regards to variables. > >Do those from other languages that have variables every expect this to >happen... > >>>word1: "cat" >>> >== "cat" > >>>word2: word1 >>> >== "cat" > >>>insert word2 "a " >>> >== "cat" > >>>word1 >>> >== "a cat" > >? It's a common head-scratcher for those new to REBOL. Calling words >pointers instead of variables gives a better indication of what they >are (in the above case), I think. Though I think we should be >thinking of them as just another value of a certain datatype, same as >with "cat". Thinking of them as symbols may be nice when writing >REBOL, but will it help you when debugging? >
in this case "pointer" = "reference". Both words mean the same, but due to C "pointer" means dangerous and crash-prone. I would say "references" are pointers which can never point to invalid memory (backed by a garbage-collector, no address-arithmetik) In my rebol-terminology, the words are not references, but they contain references. for example, a: [] b: reduce[a] both the block and the word contain the same reference. Also Holgers artikel seems to imply, if i put something in a variable, it gets copied. As a beginner, i was not so surprised about the reference-stuff. no, i expected if i write [], i get a fresh copied block. specially because it works this way when testing with console. that's the hard part to understand. its quick to explain with f: func[a][append [] a] source f f 123 source f and the same with f: func[a][append copy [] a ] (eventually noting there is copy/deep, just in case) but that should be the first thing to show a newbie, and was not at my starting time. Are words variables? yes, absolutely. if they want. they are also symbols. which means one can say states: [on off broken to-hot ] state: second states if 'off = state [ noise: 'is-silent ] here some words act variables, some as symbols. finally i can do a: 123 b: [a] get first b where i use them in a mix of variables and symbols. which can be interesting when writing dialects. -Volker