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

Does the REBOL book clarify REBOL semantics?

 [1/11] from: j_gauss::paradise::net::nz at: 21-Nov-2000 10:43


Hi, I've recently been looking at REBOL and the manual. I must admit that I find the latter somewhat unclear in places. For instance, we can pass arguments with 1. 'avar 2. avar 3. :avar and maybe some other ways as well. There doesn't seem to be a place in the manual where this crucial matter is explained in terms of say 'by copy', 'by value', 'by reference', etc - conventional usage that can clarify matters greatly. Accordingly, I'm considering buying "REBOL-The Official Guide". However, before doing so I'd like to solicit your opinions on the text. Does it clarify some of the parameter passing semantics? Does it clarify the notion of a "value"? Does it ramble? Please be critical. I sent an email to join the r-tog list but I'm still being processed - for the last 3 days. Thanks in advance for your comments. jsw -- boring C programmer.

 [2/11] from: al:bri:xtra at: 21-Nov-2000 16:05


jsw, a boring C programmer, wrote:
> I've recently been looking at REBOL and the manual. I must admit that I
find the latter somewhat unclear in places. For instance, we can pass arguments with
> 1. 'avar > 2. avar > 3. :avar > > and maybe some other ways as well.
You can also pass them in strings: "avar" or in blocks: [avar] or, with care, in parenthesis: (avar)
> There doesn't seem to be a place in the manual where this crucial matter
is explained in terms of say 'by copy', 'by value', 'by reference', etc - conventional usage that can clarify matters greatly. Either the argument is a series! or a object! then it's passed as a pointer, otherwise it's passed as a copy. Check out pages 87 through 90 of the Core manual PDF for more.
> Accordingly, I'm considering buying "REBOL-The Official Guide". However,
before doing so I'd like to solicit your opinions on the text. Does it clarify some of the parameter passing semantics? Kind of.
> Does it clarify the notion of a "value"?
Yes. It explains it in some detail. Basically a value is the "meaning" assigned or referenced by a word. For ease of your mind, think of Rebol words as pointers or references to values or meaning.
> Does it ramble? Please be critical.
Uhm, it does ramble a bit. But then people might get the impression I'm too brief.
> I sent an email to join the r-tog list but I'm still being processed - for
the last 3 days. I've just checked and you seem to be a member of the list. It has been quiet on that list, however. Andrew Martin Rebol programmer in NZ. ICQ: 26227169 http://members.nbci.com/AndrewMartin/

 [3/11] from: g:santilli:tiscalinet:it at: 21-Nov-2000 12:31


j-sw wrote:
> There doesn't seem to be a place in the manual where > this crucial matter is explained in terms of say > 'by copy', 'by value', 'by reference', etc - conventional > usage that can clarify matters greatly.
This is because REBOL just passes values. Some REBOL values are immutable (=> "passed by value"), some (mainly SERIES!) are mutable (=> "passed by reference"). The use of 'word or :word in function definitions fro argument names changes the way function arguments are retrieved, not how they are passed. 'word means: if the argument is a word, don't evaluate it, but just pass the word, as if it was a lit-word; :word means: if the argument is a word, pass its value without evaluating it; otherwise just pass the next value without evaluating it. If you find this unclear, just let me know, and I'll try to explain it better. Regards, Gabriele. -- Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/

 [4/11] from: rebol:techscribe at: 21-Nov-2000 11:13


Hi -sw, you wrote:
> Accordingly, I'm considering buying "REBOL-The Official Guide". > However, before doing so I'd like to solicit your opinions > on the text. Does it clarify some of the parameter passing > semantics? Does it clarify the notion of a "value"? Does it > ramble? Please be critical.
As the author of "RTOG" I'm perhaps a little biased ;-). I think that Chapters 1 and 3 - 6 will give you a good basis for working with REBOL From 1982 - 1987 my primary programming language was C, and I believe that these chapters will help you more easily master REBOL language constructs that may be a little confusing for programmers who are accustomed to think in terms of C constructs. Chapters 7 - 9 illustrate the application of the material covered in Chapters 3 - 6. In these chapters I had the reader in mind who is learning REBOL as a first programming language. For you these chapters are probably boring, because as an experienced programmer you will alread know how to assemeble language constructs into a program. You should still browse through these chapters because they also introduce some new material. Chapter 10 is an exercise in using the find function. Chapter 11 should be of interest to you, since it discusses REBOL's built-in debugging tools and explains REBOL's exception system in some detail. Chapter 12 (pages 300 - 337) covers string parsing in some depth. Chapter 22 covers block parsing, which is the basis for implementing Small Languages in REBOL (dialects). I think Chapters 11 and 22 will help you get a quickstart with parsing. (Block parsing was introduced around the time the book was supposed to go to the printer. That's why block parsing ended up in the hastily written Chapter 22 ;-). Chapter 13 contains a rather useful discussion of contexts (and objects). Chapter 14 contains "all you need to know" for using REBOL as CGI agent. It also shows you how to use REBOL to simplify the process of generating HTML code. Chapters 16 - 18 assembles relatively useful (and reausable) material for working with objects. Chapter 19 will show you how to use high-level Internet protocols, but as a C programmer you will probably find Chapter 21 more intriguing. This chapter covers the low-level implementation of the port mechanisms and should contain just about enough information for you to implement your own protocols. Hope this helps. Elan

 [5/11] from: j_gauss:paradise at: 21-Nov-2000 21:27


At 16:05 21/11/00 +1300, Andrew Martin kindly replied: [snip]
>Either the argument is a series! or a object! then it's passed as a pointer, >otherwise it's passed as a copy. Check out pages 87 through 90 of the Core >manual PDF for more.
So series' and objects are passed by ref while all else are passed by copy? [snip]
>> I sent an email to join the r-tog list but I'm still being processed - for >the last 3 days. > >I've just checked and you seem to be a member of the list. It has been quiet >on that list, however.
Hmm, still shows 'pending' for me. I did change my email address though. Must chase that up. Thanks for taking the time Andrew. Much appreciated. I'll be looking at the manual again. jsw -- bumbling newbie

 [6/11] from: sw:paradise at: 22-Nov-2000 18:28


At 12:31 21/11/00 +0100, the illustrious Gabriele wrote:
>j-sw wrote: >> There doesn't seem to be a place in the manual where
<<quoted lines omitted: 13>>
>If you find this unclear, just let me know, and I'll try to >explain it better.
Thanks for the notions of "mutable" and "immutable". I shall be having a look at the relevant parts of the manual and considering these in light of what you and Andrew Martin have said so far. Q. Are these notions in Scheme and are there parallels? Q. If yes, is there a close mapping between the use of the terms in the two languages? If yes then if I look up these terms in Scheme I can get more info. With thanks. s narayan s (aka j-sw) --examining other world views

 [7/11] from: sw:paradise at: 23-Nov-2000 7:08


At 11:13 21/11/00 -0800, the illustrious Elan graciously replied:
>Hi -sw, >you wrote:
<<quoted lines omitted: 40>>
>Hope this helps. >Elan
Thanks for that excellent description. Will be ordering my copy from "Flying Pig" in NZ in a couple of hours when they open. Much obliged. j-sw --intrepid REBOLler

 [8/11] from: lmecir:mbox:vol:cz at: 22-Nov-2000 22:02


Hi,
> At 16:05 21/11/00 +1300, Andrew Martin kindly replied: > > [snip] > > >Either the argument is a series! or a object! then it's passed as a
pointer,
> >otherwise it's passed as a copy. Check out pages 87 through 90 of the
Core
> >manual PDF for more. > > So series' and objects are passed by ref while all else are > passed by copy? >
My point of view differs a lot here. Statement #1: * In Rebol all arguments are passed by value, regardless of their type. * proof: function [argument] [check] [ check: func [arg] [ print ["Arg:" mold arg] arg: either arg = true [false] [true] print ["Changed arg:" mold arg] ] print ["Argument supplied:" mold argument] check argument print ["Argument after return:" mold argument] ]
>> proof true
Argument supplied: true Arg: true Changed arg: false Argument after return: true
>> proof false
Argument supplied: false Arg: false Changed arg: true Argument after return: false
>> proof [1 2]
Argument supplied: [1 2] Arg: [1 2] Changed arg: true Argument after return: [1 2] The above means, that the Rebol argument passing mechanism is uninteresting from this point of view. The next natural question may be: Are the benefits of "By Reference Argument Passing" lost for the Rebol users? The answer sounds: "No", and here is why: Statement #2: * Some Rebol values can reference other Rebol values. * Examples: a) A Rebol word can reference the value the word "contains". b) A Rebol series can reference the values the series "contains", moreover, it can even reference all the values its head series contains.

 [9/11] from: gchiu:compkarori at: 23-Nov-2000 17:14


On Thu, 23 Nov 2000 07:08:09 +1300 [sw--paradise--net--nz] wrote:
>Thanks for that excellent description. > > Will be ordering my copy from "Flying Pig" in NZ > in a couple of hours when they open.
I got my copy in Lambton Quay. Cheaper than flying pig. -- Graham Chiu

 [10/11] from: g:santilli:tiscalinet:it at: 23-Nov-2000 13:01


[sw--paradise--net--nz] wrote:
> Thanks for the notions of "mutable" and "immutable". I shall > be having a look at the relevant parts of the manual and
<<quoted lines omitted: 3>>
> Q. If yes, is there a close mapping between the use of the > terms in the two languages?
I think Ladislav is the one who should answer you here. :-) Indeed, those terms are not officially used in REBOL.
> If yes then if I look up these terms in Scheme I can get > more info.
Perhaps. But always try to approach REBOL with a free mind; concepts from other languages (even languages like Scheme that's so close to REBOL) tend to make confusion when applied to REBOL. The simplest way is the REBOL way. Regards, Gabriele. -- Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/

 [11/11] from: sw:paradise at: 23-Nov-2000 21:04


At 17:14 23/11/00 +1300, Graham Chiu helpfully informed:
>On Thu, 23 Nov 2000 07:08:09 +1300 > [sw--paradise--net--nz] wrote:
<<quoted lines omitted: 3>>
>> in a couple of hours when they open. >I got my copy in Lambton Quay. Cheaper than flying pig.
Darn, already ordered. Knew there was another reason for living in Wellington apart from the excellent CompKarori! :-) s narayan s -- isolated Hamiltonian

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted