Cool, I thought! Let's see how Rev compares with file read. This would help me to learn various aspects of Rev coding: reading files, chunk expressions, and LOOPING ( :evil: ).
Here is the Ruby code. I'm not even going to show you what my Rev code (equally simple -- at first) looks like.
Code: Select all
#!/usr/bin/ruby
len = 0
words = []
while line = gets()
if line.size == len
words.push line
elsif line.size > len
words = [line]
len = line.size
end
end
for word in words
print word
end
Of course, one thing led to another: Basically, I asked myself "Can I make it faster? Is there another way to read a file other than line-by-line? Oh, and, what if I add a really cool progress bar?"
:? But, I should have stopped there. Several hours (12+) later, I ended up fighting the repeat construct while trying to update a frickin' progress bar. OK, so why not forget the repeat construct and just use a counter in a recursive command? It worked great -- once. Looks like I discovered runaway recursion -- now what? Back to the repeat construct.
And then there was the send and/or dispatch experiment -- just as horrible within the repeat construct.
So, did I get this thing to work with a scrollbar? YES
What did I learn along the way?
1) Rev syntax is ambiguous and can take weeks to master (Translation: It has a high frustration curve.)
2) Memorize the Rev language Dictionary -- Yes, really.
3) You can ignore how the message path works. NOT!!
3) repeat constructs are BLOCKING -- can anyone point this out in the documentation, as it's not in the Dictionary when you lookup "repeat."
4) DO NOT perform user-interface (screen) updates within a repeat construct.
5) If you DO need to do the above, remember this: mod is your friend! (Look it up. It's in the forums.)
6) Execute your unnecessary and frivolous screen updates within an if .. mod .. end if construct. In other words, don't keep calling any other handler through each repeat iteration -- it will cripple your repeat loop.
7) You can learn patience trying to implement really small, harmless, code snippets!
8) Who needs stinking scrollbars when Rev can read a huge text file almost instantaneously using the URL (file: ...) thingy. (Yes, it consumes memory, but it's very fast and convenient.)
9) Are you sure producing an application is faster than other languages like Ruby, Python, Smalltalk, Visual Basic??? Maybe with a few years of serious Rev coding.
10) And, finally: People write games in Rev?
How will I improve this horrible experiment?
Instead of using a scrollbar, I will see if it is possible to implement an animation. The animation will be started by sending a message to that handler BEFORE starting the repeat construct. Once the repeat ends, I will send another message to stop the animation. Hmm...probably another 12+ hours.
The sad realization of my experiment
I have only brushed the surface of Rev's ambiguity and complexity. I shudder at the thought of experiencing my future efforts to create an internet-capable and SQL database application. But, the strange thing is this: I like the challenge. And that's why I spent more than 12 hours trying to get a stupid scrollbar to work -- nicely. :)
Thanks for reading. Happy Rev'ing.