Kuro5hin.org: technology and culture, from the trenches
create account | help/FAQ | contact | links | search | IRC | site news
[ Everything | Diaries | Technology | Science | Culture | Politics | Media | News | Internet | Op-Ed | Fiction | Meta | MLP ]
We need your support: buy an ad | premium membership

[P]
Meet Rebol/View 1.0

By Chiron in Technology
Mon Apr 16, 2001 at 08:56:41 AM EST
Tags: Software (all tags)
Software

April 9th, Rebol Technologies introduced a new programming environment that has finally provided us with an alternative to Tcl/Tk for quick, easy to build GUIs. Rebol / View is poised to make good on the promises of JavaScript, Java, and other technologies.

Below is a quick introduction to the ease of building simple interfaces with Rebol.


To start, let us take a quick look at a sample program written for Rebol/View. This snippet of code uses a Rebol "Dialect" called VID (Visual Interface Dialect) to describe a simple dialog box, and displays it to the user with a familiar message.

hello-world.r
    view layout [
    vh2 center "Hello World!"
        button center "Quit" [
        quit
    ]
]

Enter this code with your favorite text editor, then run 'rebol hello-world.r' to execute it. If you're using a Macintosh, or other command-promptless OS, simply drag and drop the hello-world.r program onto Rebol/View. You should be presented with the classic "Hello World" dialog box, and a "Quit" button, all very neatly arranged.

Let's dissect this program line by line:

view layout [

Rebol's syntax may initially remind you of Tcl, Lisp, or Logo. It may take you some time to get used to the syntax, if you aren't familiar with the behavior of Tcl or Logo's expression evaluation. View is a primitive function of Rebol/View that, when given a 'Face' object, displays it to the user. Layout is another function, written in Rebol, that takes a block of VID describing an interface, and creates a Face.

One of Rebol's most unique, and powerful features is its capability to easily create and employ new parsers. A modified version of Backus Naur form is used to describe these parsers. The Rebol/Core User's Guide has an excellent chapter on how to write parsers with this feature.

vh2 center "Hello World!"

While it is possible to build graphical interfaces in Rebol using more conventional tactics, like simply adding widgets, called "Facets" by Rebol, to a created window ("Pane"), it is often simpler and faster to use the Visual Interface Dialect, to specify simple dialogs.

Using VID is much like XUL, or Glint's XML files to specify an interface. It is arranged around the concept of the "Facet", which is a kind of superwidget capable of having text, edges, images, layout information, contents and user-programmable behaviors. Each Facet has a number of Attributes, each of which specifying the accompanying edge, color and graphical effects.

It would be rather unwieldy, however, to simply use Facets to describe each and every item in you r interface, so Rebol provides us with a mechanism called "Styles" which allows you to define a class of "Facet" with common attributes. Styles can also be derived from other styles and grouped into "Stylesheets". This behavior makes writing VID interfaces much like using XML and CSS2.

"vh2" is a predefined style that creates a static text header. VID lines generally consist of a Style keyword followed by any number of Attribute keywords, strings, blocks, colors and other elements. "center" is an Attribute Keyword that instructs vh2 to center itself, horizontally. The "Hello World!" string is assumed by vh2 to be the text it is supposed to display.

button center "Quit" [
    quit
]

"button" is another predefined style. Once again, we use "center" to center the button in the window, and "Quit" for the text face of the button. Most faces can have a block of Rebol code that is executed when the face is somehow Activated by the user, either via a single click, in the case of our button, or by hitting Enter, for Text styles.

The block "[ quit ]" instructs Rebol to quit when the user presses the button.

Rebol, as a language, provides us a lot of unique capabilities, a few of which have been touched upon by this little tutorial. Its language design shows a definite emphasis a balance between concise syntax and expressiveness, which is none too surprising, considering that the chief architect of the language was Carl Sassenrath, designer and implementor of the original Amiga Operating System.

Also, Rebol supports a very wide range of platforms. Core currently supports 43 different platforms, and it appears to be Rebol Technologies' intent to port Rebol/View to the majority of them. Versions are currently available for Amiga, BeOS, Macintosh, Linux, Solaris and Windows. This high portability comes, in no small measure, from Rebol/View's graphical layer, which supports many of the graphical features that are just now being introduced to X Windows, like alpha-blending. This layer also guarantees that your GUI will look /precisely/ the same on every operating system, to every user.

Rebol also provides incredibly powerful support for the underlying protocols of the Internet today, making it just as easy to retrieve email, a web page, an ftp document, whois information and many others as it is to open a file.

Unfortunately, at the moment, much of the Rebol interpreter is closed source, although it is usually possible to use the "source <function>" command to read the Rebol source of a function. The Rebol/Core and Rebol/View distributions are free, as in beer, and redistributable, but it is necessary to pay a small cost for the added functionality of Rebol/Command and Rebol/View/Pro, which adds the ability to use extension libraries written in C, shell commands and certain cryptographic routines to the environment. This cost, compared to Qt/Win32 or RogueWave is chickenfeed, usually running around $40 or so. Considering the cost of marketing and development for Rebol, I find this rather reasonable, since bandwidth isn't free

Sponsors

Voxel dot net
o Managed Hosting
o VoxCAST Content Delivery
o Raw Infrastructure

Login

Related Links
o Rebol Technologies
o Rebol / View
o The Rebol/Core User's Guide
o Also by Chiron


Display: Sort:
Meet Rebol/View 1.0 | 34 comments (20 topical, 14 editorial, 0 hidden)
Disclosure? (2.75 / 4) (#3)
by pete on Sat Apr 14, 2001 at 06:00:28 PM EST

This feels like an ad, are you involved with this company at all?

Also:

This layer also guarantees that your GUI will look /precisely/ the same on every operating system, to every user.
Including fonts? I guess I'll see for myself, I'm downloading it now.

--pete


Yep, including fonts.. (3.50 / 2) (#5)
by Chiron on Sat Apr 14, 2001 at 06:08:54 PM EST

Rebol recommends, as a best practice, to use "Serif", "Sans Serif" and "Fixed Width" fonts, which are included with the environment. However, it is supposedly possible to use native fonts, although I haven't done so, since I find their Sans Serif to be fairly nice to look at.

As for being an employee, no, I'm not.. I'm a QA geek for another company who happened to be in desperate need of a quick, easy GUI for controlling my test automation scripts. I ran into this a week ago, and it was just what I needed. Call me an advocate, I guess.



[ Parent ]
comparison to tk or incr tk? (4.00 / 2) (#6)
by poltroon on Sat Apr 14, 2001 at 06:26:44 PM EST

I'd be curious to hear some opinion on whether this is a better alternative to (incr) tk, or just an alternative. I use incr tk for cross-platform apps. Is there any actual incentive to switch? I don't really have time to diddle around with every new GUI scripting language...

Depends on your focus.. (4.00 / 1) (#7)
by Chiron on Sat Apr 14, 2001 at 06:41:02 PM EST

Tcl/Tk, and [incr Tk] by extension, is extremely flexible for creating interfaces, but I find Rebol to be much easier to use for performing certain tasks, especially those related to e-mail, http, nntp, etc, since it provides a very good high-level interface to these protocols. Getting a file via ftp is as simple as 'open ftp://ftpserver/path/file'. It's also easy to extend the system to support new protocols.

I also find the Dialect system to be very elegant and useful for parsing things like configuration files, and various bizarre log formats that I tend to encounter in the course of testing software. Previously, I usually used a thicket of Regular Expressions using Python's re module for this, but to be honest, this fits my needs a lot better.

Also, the graphical capabilities of Rebol/View are very handy for dropping the jaws of your local marketroids. ;)

The main reason I'm bringing Rebol/View to everyone's attention, is that it appears that Rebol is trying to move into the space of providing Rebol as an alternative to Java or Javascript and HTML for presenting lightweight applications to web-users and customers. There is a fairly flexible security model already in place for controlling access to commands and files, and it appears that Rebol Technologies intends to extend it to provide a full sandbox, like that provided by Java, restricting opening ports, etc, without the user's authorization.

If you launch the demo, you'll notice that it quickly downloads each demo from Rebol before the first execution of the demo. The code for this demo is fairly interesting reading, if you're curious about this aspect.



[ Parent ]
OS/2 (2.33 / 3) (#10)
by ism on Sat Apr 14, 2001 at 06:50:25 PM EST

Wasn't REBOL one of the languages being used for OS/2, along with REXX? Was REBOL ever a free standard or did IBM give up its rights (if it ever had them)? This looks like a proprietary standard. If it's the same REBOL, it isn't all that new. The View component, maybe, but not the core language.

Not to my knowledge.. (4.00 / 1) (#11)
by Chiron on Sat Apr 14, 2001 at 06:54:12 PM EST

I didn't know of Rebol as an extension language for OS/2.. I always thought that IBM espoused only Rexx for scripting on OS/2. And you are correct, sir, Rebol/Core is a few years old. Rebol/View, however, just came out of beta this month.

[ Parent ]
Rebol rules (4.40 / 5) (#14)
by Eloquence on Sat Apr 14, 2001 at 10:46:21 PM EST

Yep, I've checked Rebol out a few months ago and even then I was amazed by the simplicity with which tasks like fetching & processing a web page could be accomplished. This Rebol/View thing is pretty impressive -- fetching all these GUI apps from the web in seconds, automatically caching them and executing them in actually decent speed, with low memory overhead! These people have been hard at work. Unlike Java, this is something I would like to have in my browser, and I think it already has very powerful security settings. My head hurts trying to imagine the number of things you could do if this became a widely used standard.

I think REBOL appeals more to the Windows crowd than the Unix crowd -- not only because it is closed source, but also because there is a real gap for a fast, powerful, easy scripting language with a GUI under Windows. The Unix folks, I would guess, are already quite happy with Tcl/TK, Perl, Python & Co. but I never found those quite appealing for Windows development. A good Tetris clone in 8K -- that's neat, and the code is actually readable. Not so many curly braces either :-). Regarding the closed source issue, well, if they port to Amiga OS and BeOS, they can't really be completely evil. What would be cool is if development of the language were paid for using a distributed patronage model, by the developers themselves. Well, a man can dream, can he not?

I think Rebol should move in the Windows+cross-platform direction. Make a browser plugin out of it. (The Rebol web-desktop, however, may be a good alternative to using the browser by slowly building their own GUI. If that works, I'm sold!) They should also make their GUI elements look & behave more like the Windows standard GUI (their GUI still has some flaws; scrolling only works with the scrollbar, the scrollbar doesn't have up&down buttons but only a slider, the dropdown menus cannot be accessed by tabbing and are not easly recognized as such etc.).

If I had more time, I would gladly do some more advocacy for it -- it's really cool. I wonder how hard it would be to write a P2P application in this? Has anyone seen a Gnutella clone or something like that?

The only thing that sucks is that Rebol is pronounced "Rebel". Like Larry Wall said, a programming language should be written as it is pronounced. I hate when people try to be clever and do stuff like this. Same goes for the TeX/LaTeX people.. yes, I know you're not talking about rubber, damnit :-)
--
Copyright law is bad: infoAnarchy Pleasure is good: Origins of Violence
spread the word!

Some more notes (3.00 / 2) (#15)
by Eloquence on Sat Apr 14, 2001 at 10:54:33 PM EST

One thing is good about the GUI: You can copy and paste most text, even if it's static. That's a real flaw of the Windows GUI. Also, the clickable examples in the "EasyVID" GUI rule. That's the way it's supposed to be done. I'm also pretty impressed by the power and speed of their example browser. How long until someone writes a real web browser in .r?
--
Copyright law is bad: infoAnarchy Pleasure is good: Origins of Violence
spread the word!
[ Parent ]
And yet another (3.00 / 1) (#16)
by Eloquence on Sat Apr 14, 2001 at 11:13:08 PM EST

Sorry for abusing this thread as my diary ;-) - I should have read Chiron's summary more carefully, apparently REBOL already has a quite powerful "style" mechanism for creating your own GUI, and there is already a Windows "skin" (screenshot here). I haven't been able to find a download link for it, though. Oh well .. time to get some sleep :)
--
Copyright law is bad: infoAnarchy Pleasure is good: Origins of Violence
spread the word!
[ Parent ]
Web-Browser in Reb/View.. (3.00 / 1) (#18)
by Chiron on Sun Apr 15, 2001 at 12:44:35 AM EST

At the moment, it will require extending the functionality present in the Face system to implement a richtext-like element, which would be essential to creating a browser like those provided by MSIE, Mozilla, or even Lynx.

As for the desktop, Carl just gave the developers on the Rebol-Ally mailing list a URL to the new View 1.1 distribution, which includes the desktop you saw back in Beta, and on the Demos page. It really hasn't added anything revolutionary to the VM, but it does do a good job of tying together a lot of the Rebol functionality into creating one extremely cool concept piece.

At the moment, I'm trying to prepare an index.r and finish a couple of my demos so I can join the 'World Wide Reb'.

[ Parent ]
P2P / Gnutella / Etc. (none / 0) (#19)
by Chiron on Sun Apr 15, 2001 at 12:52:01 AM EST

I really don't see any difficulty in writing a P2P client in Rebol. I'd love to see a P2P protocol written as an extension to Rebol, just like http et al currently are, so we could use it for peer-to-peer'ing the World-Wide-Reb distributed environment. At the moment, Rebol/View's Desktop uses web-servers to serve up the rebpages.

[ Parent ]
Schwa? (none / 0) (#28)
by bkhl on Mon Apr 16, 2001 at 02:15:16 PM EST

I am not a native english speaker, but i would think that the second wovel in both 'rebel' and 'rebol' should be pronounced as a schwa.

[ Parent ]
GUI Builder? (none / 0) (#20)
by zephiros on Sun Apr 15, 2001 at 10:56:21 AM EST

Maybe I'm just odd, but I use SpecTCL to prototype my tcl/tk UIs before I start plugging logic into the code. I mean, if pressed I can work with grid, but I usually find it quicker to handle window layout graphically. I'm not seeing any equivalent tool on the Rebol site. Am I just missing it, or is there no UI builder for Rebol?
 
Kuro5hin is full of mostly freaks and hostile lunatics - KTB
You are correct, sir.. (4.50 / 2) (#21)
by Chiron on Sun Apr 15, 2001 at 06:50:01 PM EST

At the moment, there is no UI builder tool for Rebol.. That sort of thing tends to arrive for a GUI once it has established a user base and settled down in its usage patterns. See also the GUI designers for Qt, Gtk, Tcl/Tk, Java and MSW and when in their lifecycle they got their layout editors. The only exceptions that I can think of were Delphi, which rested on the shoulders of a ton of other MSW environments and Borland's long line of excellent Pascal IDEs, and NextStep, which was a pioneer of visual application design.

The interesting thing about Rebol/View, is that the VID layer provides a fairly easy to parse and generate dialect, reminiscent of the XML-based formats provided by Glint, QT Designer and such. It would be fairly easy to implement an interface designer. Indeed, there is an example on Rebol.com of how to make any Style draggable, and to bring up a resize halo for those styles. The functionality is there, just not the manhours needed to bring it all together.

I, personally, don't use those tools, because they're never flexible enough to deal with my designs. My interface requirements tend to be a bit unusual, tending to dynamically add and remove controls to reflect the backend's state.


[ Parent ]
A Correction.. (none / 0) (#26)
by Chiron on Mon Apr 16, 2001 at 09:31:32 AM EST

This was lost when the story left the moderation queue, since it was an editorial comment. The Macintosh platform currently does /not/ have a version of Rebol/View. I was misquoting instructions from the Rebol/Core instructions, evidently.

My apologies to the Mac Users.

GUI platform-independance (none / 0) (#27)
by Rob_u on Mon Apr 16, 2001 at 01:16:05 PM EST

This layer also guarantees that your GUI will look /precisely/ the same on every operating system, to every user.
You say that as if it's a good thing. When I'm on a Macintosh, I want my widgets to look (and, more importantly, act) like Mac widgets, and when I'm on Windows they should look like Windows widgets. That's the whole point of having a system-wide UI policy after all. The problem only becomes worse when the UI manager supports even the limited themeing of, say, Windows - when a user has explicitly specified that his or her buttons should be labeled in 42-point italic courier in orange text on a bright green background, what right does an application have to ignore that preference?

For individuals doing cross-platform apps.. It is. (none / 0) (#29)
by Chiron on Mon Apr 16, 2001 at 04:48:00 PM EST

If you've ever had to write a non-trivial program in Fox, WxWindows, or even Tcl/Tk, you may grasp the sheer and utter horror involved in trying to deploy a cross-platform application to all these systems. How does the socket library handle? Can I use select with a file descriptor? When am I allowed to use vertical toolbars? What happens when a user clicks into the window to give it focus.

Building an interface to support these disparate interfaces is problematic at best, and extremely costly in man hours, since even the best put together cross-platform libraries suffer from the charming quirks of their operating system. Case in point, see wxWindows's Toolbar widget, which comes in no less than three variants, one for Gtk, one for Msw, and one called 'Simple', which is a theoretically cross-platform version that behaves in an inconsistent manner across all these platforms.


[ Parent ]
ok, but does it scale? (4.00 / 1) (#30)
by taruntius on Mon Apr 16, 2001 at 05:40:14 PM EST

I used to think tcl/tk was really cool. Really, really cool, even. Tcl/tk saved my butt in an interface design class once, and I was forever grateful.

Then, I tried to write an actual application GUI front using tcl/tk, and I came to learn that tcl does not scale well past a few hundred lines. And there was much sadness.

Would someone who has actually used Rebol care to comment on scalability issues? Or in general, care to comment about how Rebol stacks up in the areas where people gripe most about tcl?




--Believing I had supernatural powers I slammed into a brick wall.
Rebol designed by Amiga OS designer (1.00 / 1) (#31)
by Delirium on Mon Apr 16, 2001 at 11:44:49 PM EST

It hasn't been mentioned yet so I thought I'd point out that Carl Sassenrath, the founder of Rebol, was one of the people who designed and implemented the Amiga OS. That indicates (to me at least) that Rebol isn't just another randomly thrown-together scripting language, but likely has some good design behind it.

Actually it was.. (4.00 / 2) (#32)
by Chiron on Tue Apr 17, 2001 at 03:24:29 AM EST

It was mentioned in my article, actually. *chuckle* I'm not surprised it was skimmed, tho.. It was pretty late when I wrote it.

[ Parent ]
Meet Rebol/View 1.0 | 34 comments (20 topical, 14 editorial, 0 hidden)
Display: Sort:

kuro5hin.org

[XML]
All trademarks and copyrights on this page are owned by their respective companies. The Rest 2000 - Present Kuro5hin.org Inc.
See our legalese page for copyright policies. Please also read our Privacy Policy.
Kuro5hin.org is powered by Free Software, including Apache, Perl, and Linux, The Scoop Engine that runs this site is freely available, under the terms of the GPL.
Need some help? Email help@kuro5hin.org.
My heart's the long stairs.

Powered by Scoop create account | help/FAQ | mission | links | search | IRC | YOU choose the stories!