Re: DSSSL syntax

Subject: Re: DSSSL syntax
From: Paul Prescod <papresco@xxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 19 May 1997 09:37:02 -0400
James Clark wrote:
> One possible kind of alternative syntax is a C/C++/Java/CSS like one.
> Another possible kind is an SGML/XML based one.

That's true. How does an SGML/XML one scale? For instance when you
switch to programming "mode" do you completely switch to Lisp/#!key
syntax? 
 
> I think this stops being natural when you start trying to doing programming.
> But for this, an alternative syntax seems less important to me: the fact
> that you have to program in a functional way is a far bigger leap for a
> C/C++/Java programmer than is the syntax.

I think that functions provide a very nice abstraction mechanism even if
you never try to do iteration/recursion. For example:

(define *bf-size*			;; (these are from Richard Light's TEI-Lite
stylesheet)
  (case *visual-acuity*
	(("normal") 10pt)
	(("presbyopic") 12pt)
	(("large-type") 24pt)))

(define (INLIST?)
  (or
    (equal? (gi (parent (parent))) "LIST")
    (equal? (gi (parent (parent))) "LISTBIBL")))

(define (DISPLAYDIV align)
  (if
    (TOP-LEVEL-DIV?)
    (STANDARD-PAGE-SEQUENCE)
    (make display-group
          quadding: (case align
	            	  (("LEFT") 'start)
			  (("CENTER") 'center)
			  (("RIGHT") 'end)
			  (else 'justify))
	   (process-children-trim))))

I think that your average perl hacker could recognize and intuitively
use an infix version of these without understanding functional
programming.

function displaydiv( align ){
	if top-level-div?() then{
		standard-page-sequence();
	}else{
		let quadding = switch( align ){
					case "left": 'start;
					case "center": 'center;
					case "right": 'end;
					else 'justify};

		make( display-group, 
			quadding: quadding,
			process-children-trim() );
	}
}

There are some "funny" things in there (to a Perl hacker), but they are
actually generalizations of concepts generally available in procedural
programming languages. For instance the "inline switch" is just an
inline version of the familiar switch statement. I would hope that most
Perl hackers would consider that actually a cool generalization of a
familiar idea. So I think that there is some argument for an infix
syntax for the programming parts (if we decide to keep them in DSSSL on
the Web). Perhaps a variant of JavaScript syntax. It already has lexical
scope and dynamic variables.

 Paul Prescod

 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread