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

Newcomer difficulties with Rebol

 [1/6] from: gchillemi:aliceposta:it at: 17-Dec-2007 6:55


As Newcomer I have faced many difficulties with Rebol due different working in varius situation or different expectations. You must read a lot before understanding this or that different behavior The first time I faced a conceptual problem has been in Forall and Forskip. They both returned the series at its tail. I expected to have the series at its starting point when forall and forskip have been started. The second different working is between using numerals or path values on series: a: "12345" -> probe a/5 returns 5, a/22 returns none, seventh a returns "Out of range or past end", I expected a -none- value too. The third is a very big difference between what I expect and what I get. I am talking about copy/part. a: "12345" probe index? find a => 3 probe copy/part a 3 => "123" probe copy/part a find a "3" => "12" I expected 3 being the return value of -find a "3"- as it is the index of the series returned by the fuction find but Rebol works differently considering it the "end position" The fourth learning difficulty arised on string inside objects and functions they are static and global. I must use COPY to have another issue of the string. Instead I would expect to have it initialized each I declare a: mystring . For the same reason I must use COPY/DEEP to copy sub-blocks inside block of data. Giuseppe Chillemi

 [2/6] from: greg:schofield:iinet:au at: 17-Dec-2007 15:14


Good on you Guiseppe for bringing this up. I understand that some of these problems may be addressed in REBOL 3, but there is a major problem with the documentation for newbies - some things work as you would expect and others don't and it is very hard to work out why they don't. REBOL needs to consolidate its documentation, which I think is underway as well, but somehow it also needs to explain its logic as a concept that can be easily understood. I keep getting lost with really simple stuff, mainly because I keep trying to understand it in my own terms and not in REBOL's terms. May I suggest that one thing that is needed is textbook, not a manual (we need that too of course). A textbook would use very few examples, but concentrate instead on how things are done in REBOL and why they are done that way. It would have to be well written by someone who knows it inside out and can write clearly, coherently and well. It cannot be a manual, but simple prose that has only one purpose - create the concept of what REBOL is as a language, and explain its major features from blocks to dialects, in terms of a general concept. REBOL is very different to any other scripting language I have used (not many, LAU, REXX, Python, and a tiny tiny bit of JAVA script). Greg Schofield Perth Australia --- Message Received --- From: Giuseppe Chillemi <gchillemi-aliceposta.it> To: rebolist-rebol.com Reply-To: rebolist-rebol.com Date: Mon, 17 Dec 2007 06:55:04 +0100 Subject: [REBOL] Newcomer difficulties with Rebol As Newcomer I have faced many difficulties with Rebol due different working in varius situation or different expectations. You must read a lot before understanding this or that different behavior The first time I faced a conceptual problem has been in Forall and Forskip. They both returned the series at its tail. I expected to have the series at its starting point when forall and forskip have been started. The second different working is between using numerals or path values on series: a: "12345" -> probe a/5 returns 5, a/22 returns none, seventh a returns "Out of range or past end", I expected a -none- value too. The third is a very big difference between what I expect and what I get. I am talking about copy/part. a: "12345" probe index? find a => 3 probe copy/part a 3 => "123" probe copy/part a find a "3" => "12" I expected 3 being the return value of -find a "3"- as it is the index of the series returned by the fuction find but Rebol works differently considering it the "end position" The fourth learning difficulty arised on string inside objects and functions they are static and global. I must use COPY to have another issue of the string. Instead I would expect to have it initialized each I declare a: mystring . For the same reason I must use COPY/DEEP to copy sub-blocks inside block of data. Giuseppe Chillemi

 [3/6] from: petr:krenzelok:seznam:cz at: 17-Dec-2007 10:55


> a: "12345" > probe index? find a => 3
<<quoted lines omitted: 3>>
> the series returned by the fuction find but Rebol works differently > considering it the "end position"
yes, maybe a bit confusing, but handy behavior. We are evaluating from left to right. So - what is first is copy/part function. And it either accept number of chars to copy, or it takes position you want to copy to. Your logic here is imo not rigth. You clearly stated, you want to copy/part a , starting at the head of 'a. To achieve what you want to achieve, you would have to reverse logic - " probe copy/part find a "3" 3" or use some other aproach. This behavior is handy especially when using change/part. You don't need to care, and the exact part is being replaced and string shifted for you.
> The fourth learning difficulty arised on string inside objects and functions > they are static and global. I must use COPY to have another issue of the > string. Instead I would expect to have it initialized each I declare a: > "mystring". For the same reason I must use COPY/DEEP to copy sub-blocks > inside block of data. >
Ah, ok. This is really a bit difficult category of problems for newcomers. Subobject sharing caused me many headaches, especially in View, when I directly accessed e.g. button border. It changed all button borders instead :-) The most difficult part of REBOL series operation is unbound strings/blocks! So many times I found out, that their values is shared/persistent, that to be safe I use copy when not sure of the result :-) I think that Core documentation tried to explain series concept nicely. What I would probably do is to create some gotchas category, describing exactly those small details, which might take you tens of minutest to debug ... Petr

 [4/6] from: gchillemi::aliceposta::it at: 17-Dec-2007 11:48


> > a: "12345" > >
<<quoted lines omitted: 11>>
> > > yes, maybe a bit confusing, but handy behavior. We are
[...] Petr, don't forget many of us are coming from other languages where the standard working is "the return value from a function is the argument of another". When I think the return value of "find" is 3 and it goes as argument to copy/part I suppose it would be the same of writing 3 by hand copy 3 chars from the position A is pointing to. Instead Rebol is different and interprets it as the ending position. I would have written this into the manual in VERY LARGE BLINKING FONT as I have read it at least 5 times without noticing this working.
> I think that Core documentation tried to explain series > concept nicely. > What I would probably do is to create some gotchas category, > describing exactly those small details, which might take you > tens of minutest to debug ...
It is the reason I have written this message. As mediocre Rebol Programmer I could give a point of view on the documentation that the Pro Rebol coders don't have. Giuseppe Chillemi

 [5/6] from: chris-ross:gill at: 18-Dec-2007 1:38


HTH -- visualizing series:
>> a: "12345"
- 1 | 2 | 3 | 4 | 5 |
>> z: "abcde"
- a | b | c | d | e |
>> b: find a 3 ; remember, 'find probably 'forms that 3
| 1 | 2 - 3 | 4 | 5 |
>> index? b
1 2 (3) 4 5 6 -- index | 1 | 2 - 3 | 4 | 5 | 3
>> copy/part a b
- 1 | 2 | 3 | 4 | 5 | | 1 | 2 - 3 | 4 | 5 | <----------->
>> skip a 3 ; next next next
| 1 | 2 | 3 - 4 | 5 | ------1-----2-----3>
>> copy/part a 3
- 1 | 2 | 3 | 4 | 5 | <------1-----2-----3> | 1 | 2 | 3 |
>> c: find/tail a 3
| 1 | 2 | 3 - 4 | 5 |
>> copy/part a c
- 1 | 2 | 3 | 4 | 5 | | 1 | 2 | 3 - 4 | 5 | <-----------------> | 1 | 2 | 3 | On Dec 17, 2007, at 4:48 AM, Giuseppe Chillemi wrote:

 [6/6] from: chris-ross::gill::com at: 18-Dec-2007 1:58


Visualizing series (take 2):
>> a: "12345"
- 1 | 2 | 3 | 4 | 5 |
>> z: "abcde"
- a | b | c | d | e |
>> b: find a 3 ; remember, 'find probably 'forms that 3
| 1 | 2 - 3 | 4 | 5 |
>> index? b
1 2 (3) 4 5 6 -- index | 1 | 2 - 3 | 4 | 5 | 3
>> copy/part a b
- 1 | 2 | 3 | 4 | 5 | | 1 | 2 - 3 | 4 | 5 | <-----------> - 1 | 2 |
>> skip a 3 ; next next next a
| 1 | 2 | 3 - 4 | 5 | ------1-----2-----3>
>> copy/part a 3
- 1 | 2 | 3 | 4 | 5 | <------1-----2-----3> - 1 | 2 | 3 |
>> c: find/tail a 3
| 1 | 2 | 3 - 4 | 5 |
>> copy/part a c
- 1 | 2 | 3 | 4 | 5 | | 1 | 2 | 3 - 4 | 5 | <-----------------> - 1 | 2 | 3 | On Dec 17, 2007, at 4:48 AM, Giuseppe Chillemi wrote:

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