LanguagesREBOL: new, simple, yet powerful

REBOL: new, simple, yet powerful content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

Programmers often face complex problems as they attempt to model real-world interactions in a programming language. One assumption I always had was however complex the problem, the environment/language used by the programmer must also be as complex. Recently, I have been reconsidering this position. I now think simple languages paired with good design can tackle many complex problems; and can do so with more effectiveness and ease than complex languages. I arrived at this conclusion after the introduction of language called REBOL.

If there is one adjective that can describe REBOL, it is simple.

REBOL (pronounced REB-ul) stands for Relative Expression-Based Object Language. REBOL is an environment plus a language. The environment has been ported to over 30 different platforms making REBOL a cross-platform application. If there is one adjective that can describe REBOL, it is simple. The language constructs, syntax, operators and notations are based on the idea that they should be simple to learn use. Given that premise, the designers have succeeded. REBOL is the only language I could code after reading a document called “REBOL in Ten Steps.”

Getting started in is very easy. You can download the language for your platform from the REBOL Web site.The environment consists of a single executable file, plus a few configuration files. REBOL has an interactive environment which reminds me of old BASIC interpreters. In REBOL, everything has a value. The interpreter evaluates everything you type and determines its values.

There are two data types in REBOL. Primitive types include numbers, strings, dates, money, Email, and URL. Constructed data types include objects and functions. The values of expressions and constructs always fall under one of the two data types mentioned above.

REBOL is highly network-aware. Sending email messages or accessing a URL is very easy within REBOL. So simple that Email and URL are considered primitive types in REBOL!

Just like other languages, REBOL supports variables.

Just like other languages, REBOL supports variables. The following code segment shows a variable assignment followed by printing the value of the variable. I suggest you download the REBOL environment for your platform so you can follow along with the remaining examples. The code containing >> is what to type in and the code containing == is what the REBOL interpreter outputs.

>> myname: “Jim”
== “Jim”
>> print myname

With default configuration, the >> is the command prompt. Result of a command is printed on a line that starts with = =. Both of these symbols are customizable.

Another characteristic of REBOL is usage of natural language commands. The following code segment defines a block. (Blocks are a collection of words and values. The beginning and end of a block is noted by [ and ] respectively.)

>> fruit: [“Apple” “Orange” “Banana” “Peach”]
== [“Apple” “Orange” “Banana” “Peach”]
>> print first fruit
>> print third fruit

As mentioned before, REBOL is well aware of various networking protocols and has built-in support for them. In the user.r configuration file, you can specify your email address along with the address of an SMTP server, so you can compose and send email right from the REBOL environment. The following code segment, shows you how an email message is sent via REBOL:

send {
How are you?
Let’s have lunch.

Try the above code and send an email to yourself to appreciate how easy it is. Typically, REBOL code is stored in files with the .r extension. It is advisable that you divide a large application into several files and then call each one as needed. You can load an entire file and have REBOL execute it both from within the REBOL environment and from the outside (through a command-line argument). The latter approach is important, because it allows REBOL to be integrated into other applications. For example, REBOL can easily be used as a CGI programming language.

REBOL has some support for Object-oriented constructs, but it is not a full OO language. One can consider REBOL a hybrid of the OO and Functional paradigms. This allows REBOL to be less rigid and more flexible than other languages. REBOL can also be programmed in other languages; most likely more effort is needed when dealing with other languages.

There are a number of read-to-go applications on the site that provide you with a glimpse of what REBOL can do.

To learn more about practical aspects of REBOL, you should visit the Web site. There are a number of read-to-go applications on the site that provide you with a glimpse of what REBOL can do. For example, there is a utility that measures how long it takes to receive a response from various Web sites. Another utility performs a search and replace operation across several files in a directory. REBOL also provides a mailing list where developers can discuss various issues and share their solutions.

Today’s problems are generally complex. While sophisticated languages like C++ or Java are used to tackle such problems, REBOL advocates a new approach where simplicity along with good design is used to address complex issues. While this approach may not work everywhere, it does offer an alternative to think about. REBOL offers an environment based on simplicity, yet it is flexible and powerful.

About the author:

Piroz Mohseni is President of Bita Technologies focusing on business improvement through effective usage of technology. His area of interest includes enterprise Java, XML and ecommerce applications.


Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories