REBOL the rebel

ArticleCategory: [Choose a category for your article]

Software Development

AuthorImage:[Here we need a little image form you]

[Photo of the Author]

TranslationInfo:[Author and translation history]

original in en Georges Tarbouriech 

AboutTheAuthor:[A small biography about the author]

Georges is a long time Unix user (commercial and free). He is a Rebol fan from the beginning. If you can read French you might have a look at an earlier article he wrote about Rebol two years ago at http://www.amiganews.com/ANN/ no117/rebol.shtml

Abstract:[Here you write a little summary]

Let's say REBOL is a messaging language (it provides seamless network connectivity to HTTP, FTP, SMTP, POP, NNTP, ...), but as a matter of fact, it's much more than this. However, it's particularly dedicated to Internet communications.
REBOL stands for Relative Expression-Based Object Language.
Going to http://www.rebol.com allows you to download the latest version (2.3) of Rebol/Core for about 40 platforms. Rebol is also available from many Linux distributions but in earlier versions.
One of the news is called Rebol/View and you can download a beta version numbered 0.9 (4.1).
This last is one of the big improvements of Rebol. In this article, we'll try to make a short review of the many features of Rebol.

ArticleIllustration:[This is the title picture for your article]

[Illustration]

ArticleBody:[The article body]

Introduction

The idea behind Rebol was to create a simple language close to human languages, like a dialect... sort of. Carl Sassenrath, the founder of Rebol is well known in the computing field since he worked for Apple, Commodore, HP... The Amiga community for instance, owes him a lot.
Why talking about the Amiga? The main particularity of the AmigaOS is compactness. The latest version (3.5) of the OS, is less than 20 MB. This may sound strange for newcomers who started to work with OSes (or so) between 200 and 600 MB.
This is to explain that people forgot about small size as far as development was concerned. The tools available are quite numerous and scripting languages are quite useful. Nevertheless, they often imply many lines of code, whatever you want to do with them. Usually, these languages are used for specific tasks. Perl or Rexx for instance are much appreciated by Sysadmins. Obviously, you can do much more than network administration with languages such as Perl.
Nevertheless, talking about versatility and compactness, Rebol is a model.
We could say you can do just everything with Rebol. The limit doesn't come from the language but from your imagination.
Let's make a quick guided tour.

Presentation

As we said before, Rebol is available for more than 40 platforms.
This concerns Rebol/Core, that is the essential program. Rebol/Core provides you with a tool allowing to develop any type of applications, even if its favorite field stays the Internet.
With Rebol/Core you can manage web, ftp, email communications and cgi scripts. You can manipulate text, html... But you can also use it to write system commands or much more sophisticated programs.
The present version is 2.3 and it's about 350/400 Kbytes (uncompressed) according to the platform. It consists of an executable and two configuration files: rebol.r and user.r. The last one doesn't exist when you download the archive. It will be created at first start. Accordingly, there's nothing to say about installation, as you just have to put these files in a directory named rebol (for instance).
Usually, you'll have to set an environment variable to locate the directory you created.
You'll find some more files in the archive: 2 scripts and 2 html docs. One script can be used for feedback (hence its name) and the other one called rebdoc.r allows you to generate the doc (keywords) in html format. The 2 html files concern setup and notes. More documentation is available from the Rebol web site.
Next, you can get Rebol/View. To make it short, let's say it's Rebol's GUI. MUCH MORE on this later!
At the moment of this writing Rebol/View is only available for Amiga, FreeBSD, Linux and Microsoft things. BeOS R5, Irix, HP-UX, AIX, Solaris Sparc versions are pending and so should appear very soon.
Rebol/View is a single executable of about the same size as Rebol/Core. Let's add it's a beta version (0.9.9 release 4.1).
Put it where you want to and at first start it will ask you for network parameters. A documentation and a FAQ are already available from rebol site.
For information, two more products are available: Rebol/Command and Rebol/Apache.
Rebol/Command will be released very soon and will be a commercial product intended to access DLL, applications and databases.
Rebol/Apache will be a plug-in module for Apache.
And now, what can we do with this?

Rebol/Core

If you are new to Rebol (or not!), the best thing to do is to download the example scripts. There are about 200 of them!
How to run a script may depend on the machine (OS). On OSes with a shell (or shell alike ...) you type something like "rebol test.r". The suffix .r indicates a Rebol script. To test you can also write "do %test.r".
On OSes without shell, such as MacOS (except MacOS X, obviously!) you just have to drop the script icon on the Rebol executable icon. That's all!
This works on Microsoft things too, for instance.
Now let's go to the heart of the beast!
Here is a Rebol script from the examples called mailsend.r.

REBOL [

Title: "Email Message Sender"
File: %mailsend.r
Date: 10-Sep-1999
Purpose: {A very simple way to send an email.}
Note: {
The TRIM function below is used to remove the blank
lines from the head of the email, so that the first
line of text gets used as the subject.
}
Category: [email net 1]
]
send luke@rebol.com trim {
Hi there.
Just wanted to send you an email message from REBOL.
-Friend
}

As a matter of fact, there is ONE line of code!
From the starting REBOL to the closing "]", it can be considered as a header, even if it is required for every Rebol script.
The last part is the message content and between you have the Rebol code:
"send luke@rebol.com trim"
The what the command does is included in the header "note" of that script.
That's enough to send a mail as soon as your machine is properly configured.
If you know a way to make that shorter, just let us know!
Rebol scripts are interpreted and communicate through ports (a bit like Rexx does) and since they are small in size, the result is quite fast.
Well, for people knowing Rebol from the beginning, this isn't surprising.
However, from release 2, you get more features, more functions... Enough to have a look at the example scripts to notice the improvement.
Everything concerning ftp, web, mail communications can be done with Rebol in a very simple way. With a few lines of code you can download files from a ftp server, fetch a web page somewhere...
You can as well manipulate text , html... An example shows you how to convert text to html with a 2083 bytes script!
Cgi scripts can be handled too. For instance, you can generate a cgi form and the associated html form.
Another feature allows you to insert a Rebol script into an html page with the script tag. Unfortunately very few browsers seem to be able to properly handle this tag. A work around would be to use Rebol as cgi to generate dynamic content.
A breathtaking 1827 bytes example creates a webserver!!!
For those who can't live without their cellphone, there's a script allowing to send message to a GSM phone...
It's possible to encrypt, to compress or uncompress files with Rebol. you can even autoextract these compressed files. Check the autoextract.r and encrypt.r scripts.
As you may have noticed, these examples are a gold mine. Check them you won't regret your time (and it's impossible to mention them all in this article).
Let's say Rebol is great! This Rebol/Core is a very good evolution justifying to upgrade... or to begin with.
Considering Rebol/View, we can't talk about evolution: it is a REVOLUTION! (or why not a reBolution?)

Rebol/View

Those among you who don't know Rebol/View should sit down and relax!
With Rebol/View you can get the same features as Rebol/Core... plus a lot more.
Only a word to summarize: INCREDIBLE!
Let's start with an example.
Here is a script called lftest.r.

REBOL [

Title: "New way to access LF languages"
File: %lftest.r
Date: 28-Jul-2000
Purpose: {Shows how easy to create buttons.}
Category: [view VID 1]
]
view layout [
title "LF the multilingual magazine"
across
button "English" button "Franšais" button "Castellano" return
button "Deutsch" button "Nederlands" button "Italiano"
]

Here is the result:

lftest.jpg

Could be the new way to access LF languages...

Let's go on... A 1413 bytes script creates a graphical text editor!!! Do you believe it? Well, here is the proof:

texted.jpg

Here it is THE script.

Do you want some more? The script image-sort.r creates a tool for displaying and sorting images: it is 3443 bytes! Look at it:

imed.jpg

This picture is brought to you by NeXTstep(TM)

Until now, we just showed the small size of the code and the great features of Rebol/View.
A question could be "can you do that with another language with so few lines of code?" and furthermore, without needing to use a turtle with brakes to compile it... (you know that thing called JIT!). Don't get cross, I'm kidding... (Well, not really ... but this is only my opinion... and I share it!). Anyway, as my fellow Atif says: TIMTOWDI (there is more than one way to do it)... but Perl is his mother tongue!
And now, Ladies and Gentlemen, something completely different.
During the 80's, we used to connect to BBSes with more or less advanced tools according to the OSes. The 90's provided us with browsers. The graphical browsers became bigger and bigger in size and now they are (at least most of the "famous" ones) like gas factories. Websites use more and more Java (sorry for that!) and browsing the web is sometimes becoming a nightmare even with fast connections. It depends on the machine, on the connection but on the browser too.
Here comes the 21st century way to browse the web... or the Reb!
Rebol/View allows you to browse the... reb without a browser!!!
With Rebol/View you can connect to some sites and do what you would do with a browser: download files, browse a site, update software...
Furthermore, you don't have problems because your browser doesn't support such version of such "product", or even worse, because the website doesn't support your OS!
Anyway, an example is much better than a speech.

connex.jpg

It's really a Internet connection! Test it yourselves... connecting to Reb sites with Rebol/View
Another example. The following is the index of LF July issue. The script is 2197 bytes and it's a working example. That means, clicking a button leads you to the corresponding article... but opening your browser.

lfissue.jpg


It would be a bit longer to make these articles readable into Rebol/View. Here is the source if you want to test the example.
If you check the Reb sites with Rebol/View you can download the code for every example. This will show you the way it works.
Another place to find useful information is the public directory created by Rebol. Every connection creates a subdirectory named by the URL. From that subdirectory, you can get source code, pictures...
Obviously, there's a lot to be said about that fantastic tool and we would need a book instead of an article. As we said before, Rebol seems to have no limits and the only limit you can find comes from your imagination.
A few notes: for this article, Rebol/Core has been tested on AmigaOS 3.5, BeOS 5, MacOS 7.1 (sorry, it's the only one I have!), Solaris Sparc 2.6, Irix 6.5.7, Not Terminated 4.0 and of course Linux (RH 6.2).
Rebol/View has been tested on AmigaOS, NT and Linux. Experimental versions were tested on Irix, BeOS 5 and Solaris 2.6.
The scripts and screenshots were done on Linux, but tested on the 6 platforms.
Concerning the scripts, they worked the same on every tested platform (except with some experimental releases of Rebol/View what is quite understandable).
The only difference concerns the speed since the machines used start from 25 Mhz to 400 Mhz! Even if the CPU frequency doesn't make it all... according to the funnel law. (Once again, thanks to my fellow Javi who is a great philosopher, even if I changed the meaning of his theory!).
That is, Mr. Intel, did you notice that if you have a 1 GHz CPU and a 100 MHz bus (or even 133 MHz), the small side of the funnel becomes even smaller?
Sorry for the digression!!!
Going back to Rebol/View, let's say, it's really fast. Browsing the reb with Rebol/View is faster than browsing the web in the usual way. Using Rebol as a development tool for applications is quite impressive too.
If you don't feel like probing that great piece of software, you're not very curious!

Future

First of all, we can expect version 1.0 of Rebol/View. As we already mentioned, a few other products are in the work. But we didn't speak about the "still to come". Rebol is working on a big, big product called Rebol/Express. It will be a commercial product fully dedicated to communications. Let's call it an Internet software. You can learn more on this product from http://www.rebol.com/products.html
Rebol/Express can be a competitor for Backweb or Marimba. Wait and see!
But knowing Rebol's people efficiency we can expect another great piece of software.
You may have noticed we didn't mention anything about licensing. Just for information, Rebol/Core is free but it isn't under GPL.
Furthermore, people at Rebol are like their products: great!
They always take into account your feedback, they even ask for it. Hence the feedback.r script available in the archive. They answer your questions and provide you with documentation and FAQ. All this for FREE!
We can also trust them for constant improvement in their work.
I really believe Rebol will become one of the main actors in communications during the next few years.
The only thing we can add is: test Rebol products and stay tuned!
We're not only living a great time, it's getting even better!