Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Programming Paradigms


Feb99: Programming Paradigms

Michael is editor-at-large for DDJ. He can be contacted at [email protected].


Sidebar: Paradigms Past: Collecting Old Computers for Fun and Profit

In 1984, I promised readers that Dr. Dobb's Journal would not summarily dump its CP/M coverage merely because DOS was the dominant operating system. CP/M is not dead at DDJ, I assured readers. This month's column doesn't contain any CP/M coverage, but it does have some of the flavor of that promise in that it examines some paradigms of the past that still have promise for the future. In doing so it honors a more recent promise to the Amiga faithful, offended by my glib dismissal of their platform a few months back. Amiga is definitely not dead. In addition to a health report on Amiga, I take the pulse of DOS and HyperCard, and provide a perfectly serious (but not too serious) answer to the question "What do you do with an obsolete computer?" But this isn't entirely a column in praise of venerable technologies. "Rebol" (pronounced "rebel" as in "Rebel Without a Cause," "The Rebel Alliance," "Rebel, Rebel, your face is a mess") is a brand-new programming language, born of one developer's quest.

The Jedi Master

Carl Sassenrath has been on a quest for something like 20 years. It's been roughly that long since he took his passion for -- and degree in -- computer languages to Hewlett-Packard, where, in addition to the work on operating systems that he was hired for, he got involved in a variety of language projects. HP was one of four test sites for a language developed at Xerox PARC called Smalltalk, and there were Lisp machines available to use, and Sassenrath took advantage of the opportunities. He wrote a C compiler for the IBM PC when it first came out, he developed a version of Forth, and he developed a system for remote procedure calls in Pascal for HP. From that last project, a fascination with the idea of programs messaging one another stayed with him. From HP he moved on to Commodore, where he wrote the multitasking operating system kernel for the Amiga, and also did some language work.

Then there was a stint at Apple, developing one of the next-generation operating systems that Apple couldn't get out the door. He used Smalltalk heavily there. Following that, he wrote a LOGO interpreter for Commodore. In the early '90s, through his company, Pantaray, he was involved with set-top boxes, CD-ROM-based computers, programming languages, content authoring systems, and digital video tools. All the while he kept looking for the right language. Lisp held some fascination, but to Sassenrath it wasn't really the answer. Then, a few years ago, he decided to quit searching and just write the language he dreamed of. Messaging would be a key part of it; in fact, it would be the heart of the language. He got funding, hired talented help, and dug in. When he came up for air last summer, the result of his efforts was Rebol.

Send [email protected] "Hello world!"

Last September, Sassenrath released the first incarnation of his vision, Rebol/Core. This product is and, Sassenrath assures us, always will be, free. That was part of the vision.

Another part of the vision was portability of code. The (interpreted) Rebol programs run on any platform on which Rebol runs, and Sassenrath has promised to put it on any platform for which he gets a serious request. That may be a hard promise to keep, but it does run on quite a variety of platforms already: Amiga; FreeBSD; Linux for Red Hat, Debian, and Slackware; Macintosh PPC; Solaris 2.6 SPARC; and Windows 95/98/NT. Because he wants it to run identically on all platforms, he hasn't opened up the source.

Another part of the vision was messaging. "What's programming about?" Sassenrath asks. "Messaging." So although the language has affinities to Lisp and to Forth, is functional as opposed to procedural, and has some object orientation, the way he characterizes it is as a network messaging language. Interestingly, the messages sent between programs are all text strings, as human readable as messages between program and person or between person and person. That makes the code easier to maintain, Sassenrath figures, sort of like cars used to be user-maintainable before their parts were electronic. That's part of the vision, too.

Some of the ideas for the language came from Sassenrath's study of linguistics, and the Chomsky hierarchy, according to which (Sassenrath says) Rebol is context sensitive rather than context independent. "You need to separate the name space from the value space," he says, and if you do, you end up with a language that is so malleable that people can mold it into the language they want. That, too, was part of the vision. You mold Rebol by creating a dialect, a specialized grammar for the language that serves your purposes.

If you do a really exhaustive count, you find that there are thousands of programming languages, because people write languages to solve all kinds of particular problems. Better they should derive a dialect of Rebol, Sassenrath thinks, and he has written the language with this in mind. And Rebol has built-in Internet features. It knows about the main protocols. Sending a file to an e-mail address is a one-liner in Rebol. The Rebol web site is maintained by a Rebol program, which you can download from the site (http://www.rebol.com/). You can also download Rebol/Core there for any of the supported platforms; the average size is about 250 KB. Other features: inheritance, polymorphism, the ability to write functions for writing functions, exception handling, and concurrency. Wherever you are in the code, if you or the kernel triggers an exception, the state will be saved.

[Editor's Note: You can hear more about the Rebol vision in Philippe Lourier's DDJ TechnetCast interview with Carl Sassenrath at http://www.technetcast.com/.]

So what does it look like? Listing One shows how to create a switch function in Rebol, and how to use it with Rebol's data types.

The Amiga Empire Strikes Back

One of the platforms Rebol runs on is, not surprisingly, the Amiga. The Amiga computer is not even a little bit dead. One estimate of the installed base of Amiga users is 100,000. Amiga is still popular in Hollywood; for example, it was used in the production of the movies Jurassic Park and Titanic, and it's used on Babylon V to animate all external views of the space ships. It's still popular among scientists and engineers; an evolving network of Amigas has been in use by NASA at Cape Canaveral since 1987, and is likely to continue in use there for several more years. There's a steady stream of new or updated software coming out for the platform, including Linux and Rebol. Other languages include assembler, C, C++, Pascal, Modula 2, Oberon, Fortran, Basic, BCPL, E, scheme, Cluster, ARexx, Lisp, and Prolog.

The Amiga 1000, as you may or may not recall, was introduced in 1985. It was a multitasking, multimedia machine (its little sister, the Commodore CDTV, was the first CD-ROM Multimedia device for home or school use). The first Amiga OS featured preemptive multitasking, 32-bit structure, and a color GUI.

Commodore made a few errors, shall we say, leading to a bankruptcy sale in 1995 in the Bahamas, where Escom AG, a German firm, bought the Amiga assets and formed Amiga Technologies. Hopes soared, hopes fell. Escom itself declared bankruptcy in 1996.

Meanwhile, though, the Amiga users and developers kept the dream alive, and in 1997, Gateway acquired the assets of Amiga Technologies and formed two corporations, Amiga Inc. in the U.S. for development and Amiga Technologies GmbH in Germany to handle marketing. The current flagship of the line is the Amiga 4000T with a 68040 or 68060 processor, but Gateway's plans include new hardware and new OS kernel. Last November, it was announced that QNX would provide the real-time OS kernel for the next version of the Amiga OS. The hardware is still unannounced as I write this, but don't expect the next Amiga to use a PowerPC or Pentium chip. And although the new Amiga will be a radical redesign, it will probably run existing (well-behaved) applications, so as not to disappoint those 100,000 fans.

And as long as I'm posting nondeath notices, here are a couple of signs of the continuing health of DOS: Ithree Micro Technology (http://www.ithree.se/) claims to have the first true 32-bit DOS and the first true 32-bit BIOS. And xChaos Software distributes the Arachne web browser for DOS 5.0, which will run on an 8086 machine with as little as 425 KB RAM. Integrated e-mail, PPP dialer. Free at http:// hotfiles.zdnet.com/cgi-bin/texis/swlib/ hotfiles/info.html?fcode=000Q41.

Never Tell Me the Odds

I don't have any official word on the health of HyperCard -- I suspect that there is no official word as I write this -- but the signs are not good. Little development seems to have been done recently toward the long-delayed release 3.0, programmers have reportedly been pulled off the project in favor of others, and rumors are that Steve is not crazy about it.

Too bad, because thousands of educators are crazy about it, hundreds of useful, entertaining, and educational products were built with it, and Apple appears to have nothing in the wings to bring on in its place. Although the current version is, frankly, an embarrassment, with its tacked-on support for color and other '80s flashback features, it is still a powerful power-user-level development system with no equal on any other platform, and the reason many people stay with the Mac, especially in Apple's maintain-market-share-or-die education market. So I find it hard to believe that Apple will drop HyperCard, even though it seems clear that this is exactly what they are in the process of doing. Quietly. So I'm making some noise about it. If Apple does drop HyperCard, that wouldn't have to mean that it's dead. First, because several products have some degree of HyperCard compatibility and might be able to step into the breach.

SuperCard began its life as a HyperCard clone and still has much in common with HyperCard. Although SuperCard has had its ups and downs as well, it is alive today and could easily profit from Apple's dropping HyperCard. SuperCard is not as easy to get to know as HyperCard and has evolved away from it in many ways, but it seems plausible that it could capture most of the stackheads out there with a little careful repositioning, compatibility tweaking, and a few other strategic changes. MetaCard is now available for the Mac as well as UNIX and DOS/Windows. It's Scott Raney's HyperCard clone, which he's been working on for years. Again, it's a different user experience, but an easy transition for HyperCard users.

LiveStage had some early buzz that suggested that it might be a HyperCard replacement. The developers, Totally Hip Software, quickly distanced themselves from that hype. The product, a front end for QuickTime, is interesting enough without the hype. But it is not beyond the realm of possibility that it could become a HyperCard replacement. If Apple dumps HyperCard, Totally Hip should think about it. What all these products need in order to capture the HyperCard audience ("market" isn't the word) is the ability to import almost all existing HyperCard stacks and run them with little or no modification. Some technical help from Apple could make that a lot easier for them. Better yet, Apple could just release the source code. Given that the primary user pool for HyperCard is students and teachers, that would seem to be a particularly good idea, if Apple isn't going to advance the product itself. In fact, I insist. Steve, let us have version 3.0 or let us have the source.

There, that oughta do it.

DDJ

Listing One

REBOL [    Title: "Switch Function"
    Date:  15-Oct-1998
    File   %switch.r
    Author: "Carl Sassenrath"
    Purpose: {
        Switch between a set of choices or a default.
        Should make C programmers happy.
    }
]
switch: func [value cases /default case] [
    "Select from a set of choices. Return the evaluated case."
    value: select cases value
    if found? value [do value]
    else [if default [do case] else [none]]
]   
Examples: {
    Print "Switch can be used in many ways:"
    ;-- Works for simple numbers:
    switch 22 [
        11 [print "here"]
        22 [print "there"]
    ]
    switch/default 400 [
        11 [print "here"]
        22 [print "there"]
    ] [ print "nowhere"]
    ;-- Or, words used as symbols:
    car: pick [Ford Chevy Dodge] random 3
    print switch car [
        Ford  [ 351 * 1.4 ]
        Chevy [ 454 * 5.3 ]
        Dodge [ 154 * 3.5 ]
    ]
    ;-- Strings too:
    html-tag: "pre"
    print switch html-tag [
        "HREF" ["Hypertext Reference"]
        "IMG"  ["JPEG or GIF Image File"]
        "PRE"  ["Preformatted text"]
        "LI"   ["Bulleted list item"]
    ]
    ;-- Times (dates, or most other types of values in REBOL):
    time: 10:30
    switch/default time [
         8:00 [send [email protected] "Hey, get up"]
        12:30 [send [email protected] "Join me for lunch."]
        16:00 [send [email protected] "Dinner anyone?"]
    ] [print "Nothing to do!"]
    ;-- The "cases" can be a variable too:
    schedule: [
         8:00 [send [email protected] "Hey, get up"]
        12:30 [send [email protected] "Join me for lunch."]
        16:00 [send [email protected] "Dinner anyone?"]
    ]
    switch time schedule
}
do Examples

Back to Article


Copyright © 1999, Dr. Dobb's Journal

Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.