Hi Gabriele, Yes, that's it! Your explanation is quite clear, and I really appreciate it.
> And I think this is the source of all your problems: REBOL has no > "scope". As long as you think in terms of scope, you may get into > problems. > > Now, REBOL gives you the illusion of having something like a > "scope" for "variables". This is just an illusion that is there > because it is useful to let new users think that way. You don't > have to learn all at once, but can learn one step at a time. When I was just starting with Rebol several years ago, I asked on this forum (or whatever list was active then) if I could safely consider Rebol contexts as the equivalent of scopes in other languages. The answer I received was that I could do that for most purposes. Well, now I'm finding that the answer was the truth, but only up to a point, and now I need to know the "real truth". As you just pointed out, scope is an illusion, and thinking in those terms has indeed gotten me into trouble. I think that it would be appropriate to include an expansion of what you've written here as an appendix to the Rebol User's Guide. It could be considered as something of a Rebol "theory of operation guide", or something like that. It wouldn't be necessary for a beginner to study it, but it would be there for others wishing to get into more advanced applications. I think it would be an extremely helpful contribution to the Rebol documentation. > If you think everything it's clear up to here, I'll go on and > explain what binding means. Yes, it's much clearer now. You did a great job. Please continue with contexts and bindings. Best regards, Bernie Schneider The individual has always had to struggle to keep from being overwhelmed by the tribe. To be your own man is a hard business. If you try it, you will be lonely often and sometimes frightened. But no price is too high to pay for the privilege of owning yourself. -- Friedrich Nietzsche -- ----- Original Message ----- From: "Gabriele Santilli" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, April 13, 2005 7:01 AM Subject: [REBOL] The truth about scope > > Hello all, > > I'll try to say a few words on the topic too. I really hope > this helps, and please forgive me if this doesn't make any sense > to you. :) > > REBOL is not the way it is for speed. It's this way because it's > simpler, and much more powerful. > > Yep, simpler. Other languages have scope, REBOL doesn't, so it's > actually simpler. > > And I think this is the source of all your problems: REBOL has no > "scope". As long as you think in terms of scope, you may get into > problems. > > Now, REBOL gives you the illusion of having something like a > "scope" for "variables". This is just an illusion that is there > because it is useful to let new users think that way. You don't > have to learn all at once, but can learn one step at a time. > > Forget about scope and variables. Make your cup of tea empty, so > that it can be filled again. :) > > Everything is data, Gregg says. Let's start from that. > > So, what is a block? A block is a series of REBOL values. In other > words, an ordered sequence of values. More precisely: an ordered > sequence of references to values. > > The "references" thing is an important one. You will have probably > noticed the effects of this. The simplest example is: > > >> s: "A string." > == "A string." > >> b: reduce [s] > == ["A string."] > >> insert skip s 2 "modified " > == "string." > >> s > == "A modified string." > >> b > == ["A modified string."] > > The first (and only) element of B is not a copy of the string S, > it's a reference to it. S and the first element of B are actually > the same value. (Almost, there's a detail I'm not going to reveal > here, for the sake of simplicity.) > > So far, so good. Isn't it? Blocks just contain references to > values. They can contain any number of such references. > > Now comes the scoop: what is a word? A word is a symbol, and a > reference to one REBOL value. > > Is that confusing? Maybe. But that's how things are. A word is > like a block with just one value. Don't be fooled by contexts and > scope, the value is referenced directly by the word value, just > like if it was a block with one value slot. > > If you think everything it's clear up to here, I'll go on and > explain what binding means. > > Regards, > Gabriele. > -- > Gabriele Santilli <[EMAIL PROTECTED]> -- REBOL Programmer > Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/ > > -- > To unsubscribe from the list, just send an email to > lists at rebol.com with unsubscribe as the subject. > > > > -- > No virus found in this incoming message. > Checked by AVG Anti-Virus. > Version: 7.0.308 / Virus Database: 266.9.8 - Release Date: 4/13/2005 > > -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.9.8 - Release Date: 4/13/2005 -- To unsubscribe from the list, just send an email to lists at rebol.com with unsubscribe as the subject.
