r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[I'm new] Ask any question, and a helpful person will try to answer.

DanielSz
3-Jun-2007
[476x2]
Lots of the fun with Rebol comes from its readability. To be fair, 
lots of people testify the same with Ruby.
Sorry for my ramblings. I'm done now.
Chris
3-Jun-2007
[478x2]
I'm intrigued by Ruby's ability to minimize statements (for example 
here -- http://www.softiesonrails.com/2007/5/22/ruby-101-clear-code
)  There does seem to be cases where Ruby can be more concise/expressive 
than Rebol.
Perhaps that should be concise -- the expressive I guess is the ability 
to set the condition after the action, in a way that is easier for 
our brains to parse.  Of course, the core of Rebol's expressiveness 
is that the language is built on top of a consistent, robust vocubulary 
(datatypes), though it can take time to learn how to construct the 
most expressive statements.  Ruby is not instinctively reflective 
(is this the right term)?  Now I'm rambling...
Oldes
3-Jun-2007
[480]
I still prefere:

shutter_clicked: does [while [camera.on? and camera.memory_available?][capture_image]]
DanielSz
3-Jun-2007
[481]
Nice article, shows how modifiers are used in Ruby, a fine language 
by all accounts. I suppose you would resort to the dialecting facilities 
of rebol to achieve similar constructions.
Chris
3-Jun-2007
[482]
(someone already posted that link in AltME, don't remember who, sorry)
Oldes
3-Jun-2007
[483]
using...

def go_crazy
    capture_image until @camera.memory_card_full?
end


...seems to be useless if you need to do more than just call one 
function.... but I don't know Ruby at all, so maybe I'm wrong
Chris
3-Jun-2007
[484x3]
Yes, but in this instance, it is easy to read.
In dialects, it is possible to order things as you wish.  In filtered-import.r, 
a rule can be followed by a condition message:

foo: integer! else "Not an integer!"


But that is limited to dialects.  In Rebol proper, you'd be limited 
to:

while [camera/memory-available?][capture-image]
or
until [capture-image camera/memory-full?]
until [capture-image camera/memory-full?] -- is an awkward construct.
Oldes
3-Jun-2007
[487x3]
REBOL: while [camera/memory-available?][capture-image]

RUBY:    def go_crazy capture_image until @camera.memory_card_full? 
end
I still prefere Rebol:)
and I don't know if you can write it all at one line in Ruby
Chris
3-Jun-2007
[490]
To be fair:

REBOL: while [camera/memory-available?][capture-image]
RUBY:     capture_image until @camera.memory_card_full?
Oldes
3-Jun-2007
[491]
ok.. that's true
Sunanda
3-Jun-2007
[492]
As Oldes says: it looks great until you need to change the action 
[capture_image] with something more complicated....Say two functions: 
What then in Ruby?
Chris
3-Jun-2007
[493x2]
Or:

REBOL: while [not camera/memory-card-full?][capture-image]
RUBY:   capture_image until @camera.memory_card_full?
I'll leave that to someone else (like I said, I'm intrigued -- I 
don't understand :)
Oldes
3-Jun-2007
[495]
The true is... thay have very nice looking pages:-(
Chris
3-Jun-2007
[496]
It seems Ruby is full of such shortcuts -- I'd love to know if they 
really are effective the larger an application becomes.  I've seen 
it written that RoR is reknowned for it's expressive approach to 
building web apps, but that expressiveness is lacking if you actually 
delve into the actual RoR application code.  I guess Rebol has its 
dark secrets when you e.g. are exploring the internals of the View 
system...
Sunanda
3-Jun-2007
[497]
Scalability/maintainabilty are an important issues.

Carl, in an early Zine article shows a way of shortening a REBOL 
assignment:
http://www.rebolforces.com/zine/rzine-1-02/#sect10.

Clever, but I was never convinced it added to maintainability -- 
what if additional processing was needed when settimg data to "active" 
?
Pekr
3-Jun-2007
[498]
What is so special in linked Ruby examples? It is just few variables/methods 
tested, just that those are named in enlgish like manner.
DanielSz
3-Jun-2007
[499]
From the article: The key is to know that keywords like return, while, 
if, unless, and until can be used as modifiers. This means that you 
put the conditional part after the keyword. Sounds silly, and sometimes 
it is. But sometimes it has a big payoff.
Chris
3-Jun-2007
[500]
Petr, it's all about expression, and expression is the key to leveraging 
any language, no?
Pekr
3-Jun-2007
[501]
Yes, but with dialects, you can be as free form as you wish ... well, 
mostly ... But of course that is different - you have to construct 
your grammar ...
Geomol
3-Jun-2007
[502x2]
What would it mean, if I in Rudy wrote:
func1 while cond1 func2 while cond2 func3 end

Would it be:
(func1 while cond1) func2 (while cond2 func 3 end)
or
func1 (while cond1 (func2 while cond2) func2 end)
or what?
*Ruby*
Anton
4-Jun-2007
[504x4]
In rebol I can make my own function to order the condition and action 
arguments how I want, but, as easy as this is,  I generally avoid 
this and just use Rebol's built-in control functions. This means 
that other users can understand what my code is doing without scraping 
around looking for the custom control flow function that I put somewhere. 
(I put myself in the "other user" category after a few weeks have 
passed since writing the code...)
So I gnash my teeth sometimes at the argument order in some functions, 
wishing for the order to be different, but it is a perfectionist 
restriction I'm putting on myself, really.
Oops, I should have read the article first. (post_comments unless 
@not_read_article?) 

Of course, in rebol, you can't put the action block before the condition 
unless it's in a dialect that allows that.
Ruby "unless" after the action, is better than Rebol "unless" before 
the action.
Unless

 afterwards is more natural and English-like, before is somewhat confusing.
Gabriele
4-Jun-2007
[508x3]
we could have do/unless [code] condition
but i'm not really sure of the advantage...
if it's just to be english-like, we can beat them any time with a 
simple dialect :)
Geomol
4-Jun-2007
[511x2]
I think, performance should win over expressiveness. I'm think, we 
don't have
action unless condition

in REBOL, because it'll cost in performance to check, if there is 
an 'unless' after the action. As it is now, the REBOL intepreter 
knows what to do most of the time. Operators are the exception of 
the rule.
It could be interesting to know, how much better performance would 
be, if REBOL didn't have infix operators. Carl probably did some 
tests.
Rebolek
4-Jun-2007
[513]
what is interesting here is, that infix operators are in fact faster 
in REBOL than prefix equivalents ('+ vs. 'add ...)
Gabriele
4-Jun-2007
[514x2]
i don't think performance would change a lot
the point is that that is just syntactic sugar
Gregg
4-Jun-2007
[516]
Since REBOL requires a programmer to 

think differently", in general what type of person, skill set, and/or 
background is required for a person to be a good REBOL programmer?" 


You just have to be open minded, and I think it helps to be curious. 
You also need to understand that REBOL is high level, but not safe 
in the sense of being dumbed-down so you can't do dangerous things. 
You can do *very* dangerous things in REBOL. You don't have direct 
mem access, so the risk is mainly to your own app, but since it's 
almost infinitely flexible, you can create works of art, or hideous 
beasts.


 "what attracted everyone on this newsgroup to REBOL? And, in general, 
 what type of applications are people trying to build?"


The small size, built-in GUI, and tiney-but-powerful demos are what 
attracted me initially. To be able to download the EXE, install it, 
and run 5 or 6 GUI demos in a couple miuntes just blew people away 
in 2001 when I showed it to them. What keeps me here is that there's 
nothing else that's as much fun to work in (for me). It can be frustrating 
too, I won't lie about that, but the benefits so far outwiegh the 
negatives for me, that I hate having to use other languages now. 
I also love the community. I would count some of the people here 
as close friends now, and it's very satisfying to collaborate with 
them, even just on fun little projects.


What *really* excites me, though, is that I think we're still only 
tapping about 5% of REBOL's potential, maybe less. If you write code 
in REBOL like other languages, there are benefits but they aren't 
earth-shattering. When we get to the point that 10% of REBOLers write 
dialects, and 90% of REBOLers use them, and use REBOL as an interchange 
format, then we'll really be taking advantage of REBOL.
Geomol
4-Jun-2007
[517x5]
Rebolek, it shouldn't be too surprising, that performance is about 
the same, whether you use + or add. When you use 'add', REBOL still 
have to be prepared, if you put in an operator after each word. REBOL 
can't evaluate the final result after
add 1 1
because what if you wrote:
add 1 1 + 1

When real penalty for allowing infix operators can only be measured 
with a version of REBOL, that doesn't have them.
*The* real penalty ...
It may be better shown in this example:
divide 4 1
is ok, but
divide 4 1 - 1

gives an error. The performance hit for infix operators may not be 
too big, but it would be interesting to know.
This might give a hint:
>> rule: ['add set a number! set b number! (a + b)]
>> time [loop 1000000 [parse [add 4 5] rule]]
== 0:00:04.880101

>> rule: ['add set a number! set b number! opt ['+ set c number! 
(b: b + c)] (a + b)]
>> time [loop 1000000 [parse [add 4 5] rule]]
== 0:00:05.541085


The rule without infix + seems to be 10-20% faster than the one with 
infix +. This is only a hint! It might be different, if the language 
were changed.
If I allow infix + after each number, the result of course get worse:

>> rule: ['add set a number! opt ['+ set c number! (a: a + c)] set 
b number! opt ['+ set c number! (b: b + c)] (a + b)]
>> time [loop 1000000 [parse [add 4 5] rule]]
== 0:00:06.360697
Gabriele
4-Jun-2007
[522]
geomol, your model of the performance hit may not be correct, because 
rebol is not evaluating things that way.
Geomol
4-Jun-2007
[523]
Yeah, I would assume something like that. :-) I have to ask Carl, 
I guess.
Ammon
4-Jun-2007
[524]
Why did I join this community? The primary reason is to be part of 
a small, smart and passionate group who think differently


That's basically the same reason I joined this community.  Like many 
others here I found REBOL through the Amiga community.  I had access 
to an Amiga 2000 when I was in elementary school and I loved it. 
 When I decided to start programming I played with some Perl, some 
VB, some C and then I signed up to the Amiga Developers List in 2001, 
through which I found this community and I've never looked back...

Since REBOL requires a programmer to 

think differently", in general what type of person, skill set, and/or 
background is required for a person to be a good REBOL programmer?"


  I think that those most likely to really grok REBOL are those that 
  "think outside of the box."  IMHO, anyone CAN be a good REBOL programer, 
  like Gregg says, what you need most is an open mind.  Curiosity does 
  help....  A lot.  There are a number of simple IQ tests that you 
  can give people to determine their ability to "think outside the 
  box."  The way they approach the problem is as important as their 
  ability to solve the problem because this shows you how they will 
  attempt to solve problems they encounter while programming.


Therefore, would a programmer with a computer science background 
with NON procedural languages like Lisp or ML be more likely to 
grok" and appreciate REBOL?"


From what I have seen, they will pick up REBOL a lot quicker than 
those without the background in lisp or a language like Lisp, however 
this doesn't necisarrily mean that they will be able to write the 
best REBOL code...

Would it make sense to 

hire" a young/new programmer out of college and get them involved 
with REBOL early so they have less "bad habits" to unlearn? Are any 
schools teaching their students REBOL?"


There is a group here, "Rebol School", that we have been using to 
discuss the topic of learning/teaching REBOL.  One of the users here, 
DenisMX, I believe has developed, or is at least working on developing 
a REBOL curriculum.
BrianH
4-Jun-2007
[525]
Geomol, I wouldn't know about R3 but in R2 ops are a little faster 
than their prefix equivalents. The reason is that DO already knows 
which words are ops, while it has to look up other words to figure 
out what they are. This lookup takes more time than just grabbing 
the right action out of the op table. It does have to retrieve the 
index into the op table from the value assigned to the op, but it's 
still faster than general action lookup. Try assigning a non-op value 
to an op word - it will error on evaluation.