Curl as a Web Content Language

You could view the Curl/Surge RTE as a runtime environment to host a domain specific language: a web content language.

Viewed in that light, it is not surprising to find the class

TableContentPrototype

in the package CURL.GUI.BASE

Using the page for the topic ‘Reflection’ in the Curl Documentation Viewer you can modify and execute the following code snippet:


{value
    let p:Package =
        {import-package
            {ComponentSelector name = "CURL.GUI.BASE"}
        }
    let members:VBox = {VBox}
    {for m in {p.get-members} do
        {members.add {String m}}
    }
    {VBox
        {HBox
            {String p & ".get-members : "},
            members
        }
    }
} 

to view the members of CURL.GUI.BASE

But it would be fun to use concrete subclasses of the abstract class TableContentPrototype to explore the parent class.

{import * from CURL.GUI.BASE}
{value
    let t:ClassType = TableContentPrototype
    let members:Table =
        {Table
            {row-prototype
                {cell-prototype t}
            },
            {row-prototype
                {cell-prototype "member"},
                {cell-prototype "name"}
            }
        }
    {for m in {t.get-members search-superclasses? = false} do
        {members.add
            {row-prototype
                {cell-prototype m},
                {cell-prototype m.name}
            }
        }
    }
    members
} 

We are able to use the procedures row-prototype and cell-prototype from the GUI.BASE package to expose the class. The package procedure row-prototype itself returns an instance of a subclass of TableContentPrototype because that is what the package procedure cell-prototype returns. Curl is highly-modular but sensibly so: there are alternate packages and super packages.

To see this all in action, download the Curl RTE and save either code snippet as a .curl file. Add a ‘herald’ at the top of the file as follows:

{curl 5.0 applet}
{applet license=”development”}

Load the file into your browser address field using

file:///C:/any-directory/my-curl-file.curl

and substitute your drive, directory and filename.
Or you can open the file using the FILE menu on your browser’s menu bar.

Or you can simply paste the code snippet into any Curl tutorial or documentation code widget which has an EXECUTE button.

The point of this? Curl is a web content language designed for the internet and intranets. It provides all of the services that are usually obtained with a mix of Java, HTML, CSS and JavaScript. Instead of requiring the Java runtime, it requires the Curl runtime. It is ready for SOA and it was RIA from the get-go.

There are other alternatives but they tend to involve a language + a layout language. Two notable exceptions are Seaside for Smalltalk and Rebol.

But what distinguishes Curl from Smalltalk is what the team at MIT dubbed ‘the gentle curve’ in learning Curl and using Curl. Many software development managers consider JavaScript to be ‘just’ scripting to be done by a ‘web developer’. The perceived need for Google’s Web Toolkit to cope with Java and JavaScript in the Eclipse IDE should give us pause. JavaScript is a very rich language with a capacity to boggle known as ‘unintended closures’. It has been ill-served by the notion that it is a kind of web-Basic script and was completely mis-named by SUN marketing.

Of course there is Ruby on Rails, but if you are going to use Ruby, what was it that decided you against Smalltalk and a mature virtual machine? Seaside with Smalltalk is just hard to beat. The tough call would be Rebol. Rebol is as deep a language as Smalltalk or JavaScript and like any such language, it is a way to express thinking about a problem. It is a software development language which happens to be ideally suited to the internet. It should lead to an OS just as Smalltalk is leading to Croquet. It already boasts an ‘IOS’.

Curl is different. Curl was designed as the language for www. Like JavaScript, it was international from the start by being built for UNICODE. It is most widely used in Japan and Korea to exploit the web in business settings.

JavaScript can be viewed as a branch of Self, which was the next generation of Smalltalk which SUN kept to itself as they did Strongtalk, the typed-Smalltalk. As ECMAScript, JavaScript may soon cease to be a dynamically-typed, prototype-based language. At that point it may be a better language for some web development or simply be overtaken by Adobe ActionScript and FLASH.

Almost any programming language can fade in a comparison: Rebol fades when compared to Oz as does Ruby when compared to a mature Smalltalk implementation. But Curl can stand on it’s own as a web content language. Rebol’s strength is in it’s ease of parsing, its dialects and its internet savvy. And its European community and US leader, Carl Sassenrath. Curl’s strength is in the breadth of its code packages and the ‘gentle curve’. And the number of its core team members who have been with Curl since it spun-off at MIT. And the number of its team members from the Far East. Its few annoyances could be readily addressed with a little syntactic sugar. It is a one-stop web language. And it is cool to Curl.

Early adoption of Curl in the LATIN-1 world may have been delayed by the dot-com crash: it was not hurt in countries where UNICODE matters to business. If you are looking to build a rich internet application, Curl5 deserves consideration. Besides, Rebol3 is still a few weeks away …

Leave a Reply

You must be logged in to post a comment.