Friday, November 7, 2008

Curl with SQLite and style skins

Last night I was setting up a Curl 6.0 desktop application and in the course of editing my DCURL file realized that some of what I had to do for styling was not obvious.

For my own stuff, it is my habit to locate projects initially in a root folder for the Curl version, so the folder for this project was in my /Curl6 (later, what I keep can move into version control on a box of mine or on the web.)

Even then I have to remind myself that by Curl6, what I mean is Curl 6.0 (in this case 6.0.4+) because in the internal surge files you will see that curl6 is Curl 5.o and Curl 6.0 is curl7 ... but you only see that if you look into the Curl Surge install directories themselves.

So when I created the new project in the Curl IDE I chose to place a new folder in my /Curl6 and I was careful to select 6.0 as my version and to choose style sheets and to use the default.

So when my project opens in the Curl IDE, the start.dcurl file contains

{install-style-sheet
{manifest-url "file", "DEFAULT-STYLE-SHEET"}
}
Now you have to think. First, I have a folder in /Curl6 which I had renamed COM.CURL.GUI.STYLED from its original (which was tagged with versioning info) and it is the PCurl "deploy" version that came in the zip file from www.curl.com

But what I need is the default stylesheet from the styles package folder. I go copy that default-style.scurl into my new folder. Oh yes, I also go get the dss-defs.scurl file as well. Now I use the IDE's Project menu to add them to my project as file resources.

But I am not there yet. My new project's manifest does not yet have an entry for a resource which actually matches "DEFAULT-STYLE-SHEET"

What my new manifest must have is

{component file DEFAULT-STYLE-SHEET,
location = "default-style.scurl"
}
So in I click on my projetc's name in the project pane and edit the project's manifest to create that identifier. Think of it as a URI. Note that it is not quoted. It could have been any useful tag of my choosing, but they need to match so as to map URI to the resource as that location. This concept of resources is part of the great flecibility of developing and deploying Curl: you are not working directly with physical file includes as in a zipped java JAR file. And you are not having to use XML.

Now to think of what more is needed: I need to delegate to my CDK and to my STYLE packages.

Up on the Project menu there is an option to add delegates, so I add two of them by selecting the manifest.mcurl file found in the folder for the CDK for SQLite and the folder for styles and skins.

Those manifest entries are now

{delegate-to COM.CURL.CDK,
location = "../COM.CURL.CDK/manifest.mcurl"
}

{delegate-to COM.CURL.GUI.STYLED,
location = "../COM.CURL.GUI.STYLED/manifest.mcurl"
}
So what more could be needed? Ah, yes, import those packages into my new DCURL text file.

The first thing I did was to add || errors next

{import * from COM.CURL.CDK}
{import * from COM.CURL.GUI.STYLED} Oops! F5 key kicks up red error messages.

If I had clicked on the "delegate" icons that were added to my prject pane, I would have seen that those manifests contain such entries as
{component package COM.CURL.CDK.SQLITE,
location = "SQLITE/load.pcurl"
}
and

{component package COM.CURL.GUI.STYLED-CONTROLS,
location = "skinned-controls/load.pcurl"
}
so what I need to decalre as my imports in my start.dcurl are
{import * from COM.CURL.GUI.STYLED-CONTROLS}
{import * from COM.CURL.CDK.SQLITE}
Now a click on F5 to run my project and all is well.

Now to open Mike Gordon's Style Designer (itself a DCURL desktop app) and away I go ...

You might also want to look over the page at Curl on style sheets - if you click the button up right to "view as PDF" ypu can also save it as a PDF if that is your preference for handy docs.

Of course, docs are always online at developers.curl.com although my preference is to use bookmarks in the the Curl Documentation Viewer that comes with the IDE (and is itself a DCURL desktop application - and so can be opened more than once on your desktop.)

Sunday, November 2, 2008

Curl and the future of the starter kit

With the passing of Ralph Griswold, an author of SNOBOL and the ICON language, I became much more aware of the importance of archiving the history of the evolution of computing. Some of this work is actual library archive tasks (boxes of paper) and some is digital.

It is my hope that the Curl4 (which means Curl 3.0) Starter Kit will find a place first in opensource and then in a proper archive as part of the evolution of the Curl language.

In general I found that the the 3.0 Curl Starter Kit (CSK) ported easily to Curl6 (Curl 5.0) except for actually using the IPC (inter-process communication) from applet to subapplet. The biggest change between the CSK and the current Curl opensource projects is probably in the XML parsing toolset. Curl has now moved to the XML Document Model (XDM) so the code is out-dated but not uninteresting to anyone interested in programming language change. At the moment I am watching the emergence of 2 languages and a major transition in a language rather like Curl, that being REBOL which is now moving from 2.0 to 3.0. REBOL has just come through the pain of moving to UNICODE (which I think should have been what the UNICON version of the ICON language should both have meant and have accomplished) but Curl has been UNICODE since its commercial release in 2001. In the case of REBOL, we should have access eventually to the message exchanges among the key players and the language community as critical choices were made. I do not know what will be made available eventually for archive for Curl.

Every project has its challenges and perhaps Curl 4.0 was such a problem child for the Curl team. That transition deserves to have its documents preserved. The evolution to Curl 7.0 and the on-going discussion of what the Curl developer community might want to see in Curl 8.0 is part of the history of a programming language: some of its virtual documents will be preserved by the very nature of the web as was the case with internet news.

The unexpected death of the chair of CS at MIT early in the life of Curl no doubt had some impact at the time. David Kranz, the chief architect of Curl, may already have his account of the early days of the language. But in history, such reporting only constitutes another document. The Curl initiative was spun-off as a commercial enterprise at a time when opensource was just emerging. And it had been the early authors of SNOBOL at Bell Labs who may have inadvertently started the process when they placed SNOBOL in the hands of their listeners in an early public talk (at least that is the legend as I know it ...)

Yesterday I had a moment to comment to some young artists that the looms in their school had a connection with the computers in their media lab. And there, too, is a connection with the last days of Ralph Griswold: weaving and computing.

Sunday, October 26, 2008

How to improve Curl

One terrific thing about Curl as a language is that the compiler directives are able to help ensure coding standards as code evolves to production quality.

One vexing thing in Curl code is to find {field } expressions occurring willy-nilly within a {define-class }.

I propose an option for {define-class } such that the expression {attributes } is the one-and-only set of fields declared as follows:
{attributes
my-i-attr1:int
my-f-attr2:float
|| etc
}
In such a class definition the {field } expression may not occur when compiler-directives include
rational? = true ||humor

I would further propose the declaration grouping
{class
}
to replace and preclude the use of
{define-proc }
within a class declaration.

For the instance-side of a class, I would propose the use of the method grouping expressions
{public
and
{private
and
{protected
and that where such expressions occur, that no
{method
be permitted to be free-standing within that class definition when rational? = true and that only one occurrence of each grouping be permitted. A further restriction might require that public precede protected which must precede private.

The {class } expression would also permit some class-side procedures to be declared as final, sealed or open.

The compiler-directive rational? = true would be stronger than stringent?, i.e., classes compiled in a rational? package would be thereby also stringent?

To take a page from another language, within these method groupings, a blank line would separate method declarations and only method declarations.

One further option is to have {i-attributes } and {d-attributes}. No default values are declared for the former as they must be initialized in a factory/constructor method whereas the latter need not.

Clean code is readable code and readable code may be maintainable code.

Saturday, October 25, 2008

The Future of Curl

Over at Curl I have added some comments to an invitation by Richard Monson-Haefel to weigh-in on improving Curl.

Divining the future of Curl means thinking outside the box. Here's a few attempts.

Pair up Curl as a client-side to Gemstone as has been done by Seaside.

Beef-up Curl on the client-side by getting serious about the future of expression-based languages: if there is not room in the marketplace for ICON, UNICON, REBOL and Curl then look to partner with the remnant of the ICON team at U. of Arizona.

If the Curl team cannot partner-up, then look to go beyond one of those languages by having more effective goal-oriented programming than UNICON or more user-friendly parsing than REBOL.

The option of viewing Curl as a platform and not a language seems to close off many avenues unless Curl, the platform, is able to embrace languages such as ICON which appear to be in need of a new home.

Or is there a niche for Curl in the future of Perl with Parrot, or Ruby with an industrial-quality VM, or distributed OZ?

One interesting place to look is GROK and what they are looking to do with Python ZOPE. That project alone might ensure the future of ZOPE.

Then there is RDF. Somehow RDF has become tied to clunky XML implementations or worse. Even now that W3C has embraced "sparkle" for RDF Data Access, we need not ignore the prospects for Curl as a potentially RDF-friendly language. Prima facie, ICON back-tracking and REBOL paths make either look more promising as a language. But Curl, the platform, could be a powerful starting point for a more language-neutral approach to RDF triples. Mozilla XUL has moved away from RDF (blame XML there, where the 'X' is for 'Xtra-heavy' rather than eXtensible.) The real-issue is how to effectively provide metadata. As more people look to HTML and XHTML itself as the answer, Curl appears to be a natural: Curl has always been metadata-friendly.

Curl CSPD could even be used to help ensure that meta-data that would disclose too much would be suppressed where privacy is an issue (think blogging in China and i-journalism most anywhere.)

Monday, September 29, 2008

Curl: what's in a name?

Actually I'm not going to carry on about Curl versus cURL today, but rather about what's optional in a Curl UI.

If you are running the Curl IDE and a Curl applet, you may not be aware that a CTRL-Right-Click gives you a popup from which you can inspect the Curl widget under your mouse pointer. So what's in a name?

Well, all Curl visual objects have options - and one option which you can set is a name. If you have a few applets sharing the same code packages, it can save you some time if you able to track that this widget 'X' in this container is in fact, say, 'the Demo-only custom drilldown label-only-hidden-button'.

Why does this matter? Well, if a widget container was instantiated declaratively, as say,
|| (somewhat simplified for illustration)
{MyContainer
{VBox {HBox {CustomWidget drilldown = anon-proc}}}}

you would have no handy instance variable (field) or local variable or getter method to access this instance of CustomWidget. Whether you are debugging production code or updating an iteration of a prototype, you may wish you had done this:
{MyContainer
{VBox {HBox {CustomWidget name="Demo drilldown here", drilldown = a-proc}}}}

Now when you use CTRL-R-Click to inspect that widget, you can flip open the options and there it is: the name. Want to set a breakpoint? Open the source file and search on that name. There you are.

So it's not so much "what's in a name" as "what useful tag is hidden in that widget ..."

Sunday, September 28, 2008

New revisions to Curl Enterprise Framework code

Over at LogiqueWerks I have re-worked the first version of the Curl 6.0 port of Paul Sheehan's Curl framework so as not to use undocumented API's for its one use of a sub-applet.

IPC between Curl applets has been something of an art ( as you will know if you have hit invalid applet exceptions or struggled with the InlineRemoteConnection class) but there are now working examples which only use documented API's (my LogiqueWerks page includes the shape-changing example which comes with the Curl IDE documentation in the 'extended' examples code.)

The interesting thing is to be able to put a breakpoint in a working framework example such as the logon to the 'VMS MOTORS' demo and see something of the Curl IPC internals by inspecting a local instance of AppletData.

For more details, see my Curl 'Developer Community' blog over at curl.com

Sunday, August 10, 2008

Falcon Programming Language

The home of Falcon at www.falconpl.org is now a regular on my browser. The official release is still shy of 1.0 and is known as Piuma, or 0.8.10.

Falcon is being built by a team but it is the child of Giancarlo Niccolai, who was looking for an alternative scripting and embeddable language which would be multi-paradigm. Falcon is an object-oriented and a messaging language which can also be viewed as either procedural or functional and which allows all four to co-exist. The emphasis is on both flexibility and performance.

Running Falcon in MSys (the Mingw version for Win32) with -? gives the following:
Usage: falcon [options] file.fal [script options]
Options:
-a assemble the given module (a Falcon Assembly '.fas' file)
-c compile only the given source
-C Check for memory allocation correctness.
-D Set directive (as =).
-e Set given encoding as default for VM I/O.
-E Source files are in encoding (overrides -e)
-f force recompilation of modules even when .fam are found
-h/-? this help
-l Set preferential language of loaded modules
-L set path for 'load' directive
-m do NOT compile in memory (use temporary files)
-M do NOT save the compiled modules in '.fam' files
-o output to instead of [filename.xxx]
-p preload (pump in) given module
-P use load path also to find main module
-r do NOT recompile sources to fulfil load directives
-s compile via assembly
-S produce an assembly output
-t generate a syntactic tree (for logic debug)
-T force input parsing as .ftd (template document)
-v print copyright notice and version and exit
-w Add an extra console wait after program exit
-x execute a binary '.fam' module
-y write string translation table for the module

Paths must be in falcon file name format: directory separatros must be slashes [/] and multiple entries must be entered separed by a semicomma (';')
File names may be set to '-' meaning standard input or output (depending on the option)

One interesting feature is the functional sequence operator .[cascade which can be used for assigning not just functions but functions applied to functions. The cascade operator can be used to declare the functional sequence as a member in an object declaration.
When Falcon fledges as a 1.0 we should have another alternative language which will be worthy of attention.
The documentation thus far is largely PDF's, so a far cry from the excellent live document viewer that comes with Curl, the web content language. Recently I found that I liked the on-line documentation for the processing language at www.processing.org but we may yet see something emerge as a 'live' documentation standard comparable to what Curl offers and Smalltalk could offer.

Saturday, February 9, 2008

CURL6 in the RIA news

There has been good news lately at the CURL.com site with Curl winning the InfoWorld 2008 RIA development platform award and with Richard Monson-Haefel coming on-board to replace the late Marc Orchant.
I continue to try to create the urban legend that CURL stands for {url

My latest enthusiasm is to see features of ICON and UNICON appear in CURL 7 as an alternative to regexp - an extension which would also see back-tracking added to CURL. There must be a way to start that rumor ...

Some other sites seem noticably quiet, such as VistaScript.net but I continue to watch the DLR site of IronPython.

It was also great to see a new Win32 package for IO available at iolanguage.com

And of course there is a lot of activity via the ALTME link of REBOL.net with the alpha-release of REBOL3 ... and that page has a link to Carl Sassenrath's Rebol3 Frontline blog.