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

link to background on Rebol language design?

 [1/22] from: bry::itnisk::com at: 18-Aug-2003 10:35


Hi, I'm wondering if anyone has a link to anything going into Rebol's design as a language, the only thing I can remember seeing were a couple articles in Dr. Dobbs a few years back which unfortunately I can't seem to find online. I'm interested in stuff focusing on language theories and their relationship to Rebol's design. Not anything talking about how easy it is to send an email.

 [2/22] from: carl:cybercraft at: 24-Dec-2003 22:32


On 18-Aug-03, bryan wrote:
> Hi, I'm wondering if anyone has a link to anything going into > Rebol's design as a language, the only thing I can remember seeing
<<quoted lines omitted: 3>>
> relationship to Rebol's design. Not anything talking about how easy > it is to send an email.
There was this from Holger Kruse a while back... http://www.escribe.com/internet/rebol/m19855.html -- Carl Read

 [3/22] from: greggirwin:mindspring at: 18-Aug-2003 10:48


Hi Bryan, b> Hi, I'm wondering if anyone has a link to anything going into Rebol's b> design as a language, the only thing I can remember seeing were a couple b> articles in Dr. Dobbs a few years back which unfortunately I can't seem b> to find online. b> I'm interested in stuff focusing on language theories and their b> relationship to Rebol's design. Not anything talking about how easy it b> is to send an email. There was some mention of it in the MIT Lightweight Languages workshop (don't have a URL handy though) and there were some old notes on REBOLForces, but I don't recall too much about theoretical aspects of the language design. REBOL draws a lot of inspiration from Lisp, Forth, and Logo. I think Carl has said that his study of denotational semantics played a big part as well. --Gregg -- Gregg

 [4/22] from: bry:itnisk at: 19-Aug-2003 9:42


> I think >Carl has said that his study of denotational semantics played a big >part as well.
Yeah, that was specifically that I was thinking about, I seem to remember reading that in Dr. Dobbs, I was hoping there was a link to something deep on that as it applies to Rebol, as I recall what I read that one time had also some discussion of dialecting, and the reason for calling what might be called a variable in another language, a word in Rebol.

 [5/22] from: greggirwin:mindspring at: 19-Aug-2003 12:42


Hi Bryan,
>> I think Carl has said that his study of denotational semantics >> played a big part as well.
b> Yeah, that was specifically that I was thinking about, I seem to b> remember reading that in Dr. Dobbs, I was hoping there was a link to b> something deep on that as it applies to Rebol, as I recall what I read b> that one time had also some discussion of dialecting, and the reason for b> calling what might be called a variable in another language, a word in b> Rebol. Forth uses the term "word". I think that's where REBOL got it. Something REBOL has done for me--in a big way--is to inspire me to read more bout other languages again, to see what it is that makes REBOL so special; what made it grab me. By reinvestigating Lisp, Logo, and Forth (among others) with my newfound REBOL perspective, I've seen them in a new light and gotten a lot more out of studying them. I should thank Carl for that as much as for REBOL itself. The whole point of Forth was that you didn't write programs in Forth you wrote vocabularies in Forth. When you devised an application you wrote a hundred words or so that discussed the application and you used those hundred words to write a one line definition to solve the application. It is not easy to find those hundred words, but they exist, they always exist. -- Chuck Moore, creator of Forth -- Gregg

 [6/22] from: carl:cybercraft at: 24-Dec-2003 22:32


On 19-Aug-03, bryan wrote:
>> I think >> Carl has said that his study of denotational semantics played a big
<<quoted lines omitted: 5>>
> reason for calling what might be called a variable in another > language, a word in Rebol.
I've seen those from RT say that REBOL words are not variables, (as apposed to calling variables "words" just to be different), and the following perhaps helps to explain why...
>> blk: [a few words]
== [a few words]
>> blk/1
== a
>> type? blk/1
== word! What is variable about 'a 'few and 'words in such an example? Okay, they can be set, unset and so on, but that's not what people think variable means in relation to programming. Thinking of them as the datatypes they are is probably the best mental view to have of them after you're past the beginner stage. -- Carl Read

 [7/22] from: joel:neely:fedex at: 20-Aug-2003 7:41


Hi, Carl, My simple-minded interpretation below: Carl Read wrote:
> On 19-Aug-03, bryan wrote: > I've seen those from RT say that REBOL words are not variables, (as
<<quoted lines omitted: 9>>
> they can be set, unset and so on, but that's not what people think > variable means in relation to programming...
Many programmers of my acquaintance (no doubt damaged by exposure to The Lancuace That Muct Not Ce Named ;-) seem to want to think of a variable as a name for an address in memory, and a reference as an address. OK if one is writing aCembler, I suppose, but woefully inadequate for real languages. My (current) mental model for REBOL is: - a WORD! is just a symbol; nothing more, nothing less; - a context is just a dictionary that maps a collection of keys (WORD! type) to associated values (any type). Therefore, during the evaluation of ... zow: func [yorick [number!]] [ yorick - 1 * yorick ] gnudge: func [sarg [any-string!] /local yorick] [ yorick: length? sarg zow yorick - 1 ] blort: make object! [ spoo: 12 yorick: "Obscure message!" phlarp: func [] [spoo + gnudge yorick] ] wabbit: make object! [ chutzpa: 'yorick nachos: func [warg [word!]] [ gnudge join "Zow! " warg ] procerus: func [] [nachos chutzpa] ] print blort/phlarp - wabbit/procerus ... the word YORICK is used in four different contexts. Therefore it is (in different "places") associated with different (unrelated) values. No RAM, no addresses, no hardware of any kind. As Dijkstra said, "It used to be the job of our programs to instruct our computers; it is now the job of our computers to faithfully obey our programs." -jn-

 [8/22] from: bry::itnisk::com at: 20-Aug-2003 15:36


>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 familiar with Rebol at all it seems most likely to me that they will see the Rebol Word as a variable, in fact, I've recently had that situation, in order not to complicate matters too much it seems easiest to say something like: Rebol calls variables words, or something similar.

 [9/22] from: greggirwin:mindspring at: 20-Aug-2003 8:28


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
b> This is nice, but if I have to communicate with someone not familiar b> with Rebol at all it seems most likely to me that they will see the b> Rebol Word as a variable, in fact, I've recently had that situation, in b> order not to complicate matters too much it seems easiest to say b> 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... -- Gregg

 [10/22] from: joel:neely:fedex at: 20-Aug-2003 9:24


Hi, Bryan, bryan wrote:
> This is nice, but if I have to communicate with someone not familiar > with Rebol at all it seems most likely to me that they will see the > Rebol Word as a variable, in fact, I've recently had that situation, in > order not to complicate matters too much it seems easiest to say > something like: Rebol calls variables words, or something similar. >
I'd agree if you'd allow me to insert one of the phrases "initially" or "during preliminary conversations" somewhere in the above. It's OK to have training wheels on the bicycle at first, but at some point they have to come off or the rider can't become a competent cyclist. Think, by way of analogy, of how to describe a REBOL block to someone who only knows an Algol-like language (Pascal, c, c++, Java, ...); - as a segment of code within a control structure d: b * b - (4 * a * c) if d < 0 [ print "The roots are imaginary!" ] - as an anonymous procedure with no arguments and no locals trace: [prin "Still alive: " print cycle-counter] ... do trace - as a variable-length argument list to a function print ["Still alive: " cycle-counter] - as an array literal scores: [95 84 99 76 89 88 92 100] - and so on... If we *really* understand REBOL blocks, we know that it is not accurate to say that a block *is* any of those things. However, when talking to a beginner, one could say that -- for any of the specific cases above -- that we are using a block *as* something they're familiar with. Likewise, one can use a WORD! *as* a variable, but as long as one continues to think that a WORD! *is* a variable, there will be other things about REBOL that will be difficult or impossible to understand. Who was it who said, "Dealing with a C programmer is like working with an alcoholic; you have to start with him where he is, but you hope not to leave him there!" ;-) -jn- -- ---------------------------------------------------------------------- Joel Neely joelDOTneelyATfedexDOTcom 901-263-4446 Counting lines of code is to software development as counting bricks is to urban development.

 [11/22] from: petr:krenzelok:trz:cz at: 20-Aug-2003 16:18


bryan wrote:
>>I've seen those from RT say that REBOL words are not variables, (as >>apposed to calling variables "words" just to be different
<<quoted lines omitted: 5>>
>order not to complicate matters too much it seems easiest to say >something like: Rebol calls variables words, or something similar.
I use the term 'pointer, although RT suggested not to use such term in conjunction with rebol words. But rebol newbies are repeating our past mistakes - they change one series, referring to other, and wonder original series changed too ... so I tell them - imagine word reference as something like poitner is ... and they get the clue ... -pekr-

 [12/22] from: maximo:meteorstudios at: 20-Aug-2003 12:54


> -----Original Message----- > From: Joel Neely [mailto:[joel--neely--fedex--com]]
<<quoted lines omitted: 5>>
> - a context is just a dictionary that maps a collection of keys > (WORD! type) to associated values (any type).
[...]
> ... the word YORICK is used in four different contexts. Therefore > it is (in different "places") associated with different (unrelated) > values.
but it is used local to those contexts just like any local space in function or within an object of any other language... Correct me if I am wrong: The difference In rebol is that binding seems to be applied individually to each word instead of being looked up by the current environment. I said once on this list that one day, your brain "wakes up and smells the bacon" in rebol. That's just what happens when one liberates himself of the concept of a variable and undestands what a word really is. My vision is that your code is the variable and its words are its values. what those values actually contain or point to is determined precisely when it is encountered, because it seems that each word stores its binding context by itself... it is not stored in the current environment or "CONTEXT". The context actually is part of the value. which is why you can execute which actually has not been set yet, meaning that the word has not been assigned to a context which has a word with that value! This is not obvious because most code block oriented functions and methods (commands like 'func, 'make, etc) will set or fix the binding just before evaluation... which is why it looks as if its using its current "environment", but actually, its the environement, which was applied individualy to each word. to a C programmer, I'd say that each word is like a double referenced variable pointer. where the first level of reference is the context, and the second one is the actual value bind. but this is still not completely exact, but is the closest I can map it to. here is my example of just how powerfull binding is within rebol. This will obviously confuse any non-rebol programmer and many novice rebolers, but that's what I cooked up when I brain when click on words and binding. We could make a more simple example, but I share with you the full version. to really understand it, actually run the code, it will give comments along with evaluated code, so its a litle easier to understand "in context ;-)" ... HTH -MAx ;-------------------------------------------------------------------- rebol[] paf: make object! [ line: "The evil joker punches robin" printline: does [ print line ] ] kaplow: make object! [ line: "batman hits the mad joker" printline: does [ print line ] ] ring: make object! [ line: "the clock rings," printline: does [ print line ] ] kaboom: make object! [ print: :probe line: {BOOM! will batman survive?} printline: does [ print line ] ] ; here's the magic! ; extract the printline of each context and add them in one block code-block: [] append code-block second get in paf 'printline append code-block second get in kaplow 'printline append code-block second get in ring 'printline append code-block second get in kaboom 'printline line: {Stay tuned for next week's ending of "batman the rebel"} print ["the word 'line is now set to:" line "^/^/"] ; what is in the block, print "THIS IS THE CODE WHICH WILL RUN:" probe code-block print "^/^/>do code-block^/" ; now run it! do code-block print {^/notice that the last print actually did a 'probe instead it is surrounded by {}. we replaced 'print by 'probe in that context^/^/} print {if we just prepare a block in the main function, which contains the same words as the code-block:} probe [print line] print{^/it will not print the same thing, because its CONTENT will be bound globally, see:^/>do [print line]^/} do [print line] ; and here we reset the binding print {^/^/In rebol, we can easily change the context of any word or block, if we bind the code-block we prepared earlier to the global context, then all the words now point to their equivalents in the global context: ^/>bind code-block 'system^/>do code-block^/} bind code-block 'system do code-block ;-----------------------------------------------------

 [13/22] from: maximo:meteorstudios at: 20-Aug-2003 13:14


IGNORE MY LAST MAIL, this one is clearer !!! I punched the send button without wanting to...
> -----Original Message----- > From: Joel Neely [mailto:[joel--neely--fedex--com]]
<<quoted lines omitted: 5>>
> - a context is just a dictionary that maps a collection of keys > (WORD! type) to associated values (any type).
[...]
> ... the word YORICK is used in four different contexts. Therefore > it is (in different "places") associated with different (unrelated) > values.
but it is used local to those contexts just like any local space in function or within an object of any other language... in rebol you can USE in one context data which is BOUND to ANOTHER context! Correct me if I am wrong: The difference In rebol is that binding seems to be APPLIED individually to each word instead of being looked up by the current environment. I said once on this list that one day, your brain "wakes up and smells the bacon" in rebol. That's just what happens when one liberates himself of the concept of a variable and undestands what a word really is. My vision is that your code is the variable and its words are its values. what those values actually contain or point to is determined precisely when it is encountered, because it seems that each word stores its binding context by itself... it is not stored in the current environment or "CONTEXT". The context actually is part of the word's value. which is why you can encounter words which actually have not been set yet, meaning that the word has not been assigned to a context which has a word with that value! This is not obvious because most code block oriented functions and methods (commands like 'func, 'make, etc) will set or fix the binding just before evaluation... which is why it looks as if its using its current "environment", but actually, its the environement, which was applied individualy to each word. to a C programmer, I'd say that each word is like a double referenced variable pointer. where the first level of reference is the context, and the second one is the actual value bind. but this is still not completely exact, but is the closest I can map it to. here is my example of just how powerfull binding is within rebol. This will obviously confuse any non-rebol programmer and many novice rebolers, but that's what I cooked up when I brain when click on words and binding. We could make a more simple example, but I share with you a cleaned up full version. to really understand it, actually run the code, it will give comments along with evaluated code, so its a litle easier to understand "in context ;-)" ... HTH -MAx ;-------------------------------------------------------------------- rebol[] paf: make object! [ line: "The evil joker punches robin" printline: does [ print line ] ] kaplow: make object! [ line: "batman hits the mad joker" printline: does [ print line ] ] ring: make object! [ line: "the clock rings," printline: does [ print line ] ] kaboom: make object! [ print: :probe line: {BOOM! will batman "rebel" survive?} printline: does [ print line ] ] print {^/^/WE WILL ACCUMULATE A CODE BLOCK WHICH CONTAINS SOME CODE FROM EACH OBJECT...^/} ; here's the magic! ; extract the printline of each context and add them in one block code-block: [] append code-block second get in paf 'printline append code-block second get in kaplow 'printline append code-block second get in ring 'printline append code-block second get in kaboom 'printline line: {Stay tuned for next week's ending of "batman the rebel"} print ["THE WORD 'LINE IS NOW SET TO:^/" line "^/^/"] ; what is in the block, print "THIS IS THE CODE WHICH WILL RUN:^/>> probe code-block" probe code-block print "^/^/>> do code-block^/" ; now run it! do code-block print uppercase {^/NOTICE THAT THE LAST 'print statement ACTUALLY DID A 'probe INSTEAD, SINCE THE OUTPUT IS SURROUNDED BY {}. WE REPLACED 'print BY 'probe IN THAT CONTEXT^/^/} print {IF WE JUST PREPARE A BLOCK IN THE MAIN FUNCTION, WHICH CONTAINS THE SAME WORDS AS THE CODE-BLOCK:
>> probe [print line]}
probe [print line] print{^/IT WILL NOT PRINT THE SAME THING, BECAUSE ITS --CONTENT-- WILL BE BOUND GLOBALLY, SEE:^/^/>> do [print line]^/} do [print line] ; and here we reset the binding print {^/^/IN REBOL, WE CAN EASILY CHANGE THE CONTEXT OF ANY WORD OR BLOCK, IF WE BIND THE CODE-BLOCK WE PREPARED EARLIER TO THE GLOBAL CONTEXT, THEN ALL THE WORDS NOW POINT TO THEIR EQUIVALENTS IN THE GLOBAL CONTEXT: ^/^/>> bind code-block 'system^/>> do code-block^/} bind code-block 'system do code-block ;-----------------------------------------------------

 [14/22] from: andrew:martin:colenso:school at: 21-Aug-2003 8:48


Joel wrote:
> Think, by way of analogy, of how to describe a REBOL block to someone
who only knows an Algol-like language (Pascal, c, c++, Java, ...); - as a path:
>> Rebol/version
== 1.2.8.3.1
>> v: 'version
== version
>> Rebol/:v
== 1.2.8.3.1 :) (Rebol path! values are a lot like block! values.) Andrew J Martin Attendance Officer & Information Systems Trouble Shooter Colenso High School Arnold Street, Napier. Tel: 64-6-8310180 ext 826 Fax: 64-6-8336759 http://colenso.net/scripts/Wiki.r?AJM http://www.colenso.school.nz/ DISCLAIMER: Colenso High School and its Board of Trustees is not responsible (or legally liable) for materials distributed to or acquired from user e-mail accounts. You can report any misuse of an e-mail account to our ICT Manager and the complaint will be investigated. (Misuse can come in many forms, but can be viewed as any material sent/received that indicate or suggest pornography, unethical or illegal solicitation, racism, sexism, inappropriate language and/or other issues described in our Acceptable Use Policy.) All outgoing messages are certified virus-free by McAfee GroupShield Exchange 5.10.285.0 Phone: +64 6 843 5095 or Fax: +64 6 833 6759 or E-mail: [postmaster--colenso--school--nz]

 [15/22] from: carl:cybercraft at: 24-Dec-2003 22:32


On 21-Aug-03, Gregg Irwin wrote:
> Hi Bryan, et al >>> I've seen those from RT say that REBOL words are not variables,
<<quoted lines omitted: 12>>
> "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... http://www.escribe.com/internet/rebol/m3532.html 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? -- Carl Read

 [16/22] from: brett:codeconscious at: 21-Aug-2003 10:46


Always a hot topic :^) One interesting mental model I occassionally use is to visualise a matrix, with REBOL words as row labels and different contexts being columns (mostly anonymous). Not always useful in practise, but sometime handy for looking down on the scene. Usually I use a model similar to that described by Max. But what is in my head is not necessarily the best way to describe it to someone new. It is better to see where they are at and try to point out the sites beside and behind them so they can find their own position easier. I used to have a section on codeconscious.com "Words are not variables" to explain the difference. I put it there because when I was learning I desperately needed to allow myself to think that thought before I could move on. The concept I had for variable at that time was not good enough (lots of compiled code in my past). However, I removed that section, because I saw that the Core guide says words may or may not be used as variables, so I thought that my website information might mislead. Different from however you explain it to yourself, there is a need to explain REBOL words to someone who has not met this concept before in a way they can understand. I'm always interested in a consise way to do so - what can we cook up that is useful? Perhaps a few targetted at different audiences: "if you are new to programming, you can use a REBOL word to....", "if you often use compiled languages, a word is different from....", "if you normally use VB you could start out by thinking a word is a bit like a variant but...", etc. The ideal one is "a word is a value that..." With their symbolic flavour, I reckon REBOL words are an ideal kind of variable, more useful than kinds I've used before. Regards, Brett.

 [17/22] from: robert:muench:robertmuench at: 22-Aug-2003 8:46


> -----Original Message----- > From: [rebol-bounce--rebol--com] [mailto:[rebol-bounce--rebol--com]]
<<quoted lines omitted: 5>>
> visualise a matrix, with REBOL words as row labels and > different contexts being columns (mostly anonymous).
Hi, this leads me to a question: Is it possible to list all contexts a word! is defined in? I know that there are a lot of anonymous contexts, those could be numbered. To me it would be very intersting to see in how many contexts a word! is defined in, what values it has in each context. Robert

 [18/22] from: robert:muench:robertmuench at: 22-Aug-2003 8:46


> -----Original Message----- > From: [rebol-bounce--rebol--com] [mailto:[rebol-bounce--rebol--com]]
<<quoted lines omitted: 5>>
> individually to each word instead of being looked up by the > current environment.
Hi, exactly! To me that's the biggest difference. Rebol doesn't the concept of a scope. A block can have a mix of words from different contexts. There is no need that all words are in the same "scope". To me a word! is a key into a lookup table to get a surrogat for it. This surrogat is looked up again etc. until a terminal symbol is reached. Robert

 [19/22] from: maximo:meteorstudios at: 22-Aug-2003 10:08


> -----Original Message----- > From: Robert M. Muench [mailto:[robert--muench--robertmuench--de]]
<<quoted lines omitted: 13>>
> word! is defined in? I know that there are a lot of anonymous > contexts,
I do not think its possible, since each word stores its context locally... we'd have to get a pointer to all contexts in ram. since the GC actually does check if a context is being used, there might be a way to get a list of all of them, but I am not sure if its accessible from the code's POV.

 [20/22] from: nitsch-lists:netcologne at: 22-Aug-2003 22:11


Carl Read wrote:
>On 21-Aug-03, Gregg Irwin wrote: >>Hi Bryan, et al
<<quoted lines omitted: 53>>
>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

 [21/22] from: brett:codeconscious at: 23-Aug-2003 11:12


> > Hi, this leads me to a question: Is it possible to list all contexts a > > word! is defined in? I know that there are a lot of anonymous > > contexts, > > I do not think its possible, since each word stores its context locally...
we'd have to get a pointer to all contexts in ram. I believe Ladislav worked out how something like this can be done. I think he iterated through all the words in the dictionary and tested them to see what other words were in the same context. Just developing the test is clever. Unfortunately I don't know where to find his site now. Regards, Brett.

 [22/22] from: lmecir:mbox:vol:cz at: 25-Aug-2003 10:48


Hi Brett and all (back from my holidays),
> > > Hi, this leads me to a question: Is it possible to list all contexts a > > > word! is defined in? I know that there are a lot of anonymous
<<quoted lines omitted: 3>>
> we'd have to get a pointer to all contexts in ram. > I believe Ladislav worked out how something like this can be done.
Max is right, I just wrote a function (original idea by Thomas Jensen IIRC), that listed all words (usually) from the context a sample word was from. The URL: http://www.fm.vslib.cz/~ladislav/rebol/contexts.html -Ladislav

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