[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What is a lightweight language



Paul Prescod <paul@prescod.net> writes:

> Bruce Lewis wrote:
> > 
> > Here's where I think Scheme/Lisp's rising popularity will come from: As
> > Shriram illustrated in his LL1 talk, s-expr syntax is like XML, but less
> > painful and more powerful.  For ambitious web developers, it's clearly
> > the next big thing.
> 
> I can't tell if you're serious. You really think that the incremental
> benefits of s-expressions would win web-developers over from
> angle-bracketed markup and from there to Lisp? I didn't see the talk so
> I may be missing some important context.

The important context is programming (as opposed to text markup).

Shriram showed a slide with a Scheme function definition.  He followed
it with a slide of the same code, but with an XML-like syntax instead of
s-exprs.  There was some clever wording on each slide (wish I could
remember exactly) alluding to the supposed superiority of the XML
syntax, when everyone could see that the s-expr version was more
readable.

> XML's tag-redundancy provides much better error recovery and readability
> (at a cost of verbosity). S-expressions-as-we-know-them also use the
> worst possible character for grouping because parens happen so often in
> ordinary text.

For text markup, where a concise end-marker could get lost in text, I
can see your point about readability.  I also understand how explicit
end markers help error detection.  I have no motivation to argue with
you about error recovery, though I haven't seen it myself.

For programming, s-exprs provide much better readability.  Not even the
XSLT folks advocate using XML syntax to structure all programmatic
expressions.  For example, from http://www.w3.org/TR/xslt#forwards

  <xsl:when test="system-property('xsl:version') &lt; 1.1">
    <xsl:message terminate="yes">
      <xsl:text>Sorry, this stylesheet requires XSLT 1.1.</xsl:text>
    </xsl:message>
  </xsl:when>

Note that for the "test" attribute of xsl:when, they've punted XML
structure.  Good decision.  Nobody would want an element like this:

<xsl:test>
  <xsl:comparison>
    <xsl:comparator>&lt;</xsl:comparator>
    <xsl:compare-left>
      <xsl:system-property>xsl:version</xsl:system-property>
    </xsl:compare-left>
    <xsl:compare-right>1.1</xsl:compare-right>
  </xsl:comparison>
</xsl:test>

> There are already terabytes of bracketed-text flowing around the
> Internet, and by now gigabytes of that is XML -- at least in source
> form and often in network form.

For that we must thank you.  The ubiquitousness of XML has given
thousands of people training that will make s-exprs easy for them.

> Even if parens become incredibly popular as a data structuring language,
> one can install an S-expression parser for Java in about fifteen
> minutes. What would motivate people to switch programming languages?

I'm not actually thinking about motivating people to switch programming
languages.  What I'm doing is providing ambitious web developers an
attractive option for getting into server-side web programming.  The
syntax feels similar to XML, yet is dissimilar enough to avoid confusion
in a template system.

I think people who aren't already accustomed to Algol with a funny hat
will really like BRL.

-- 
<brlewis@[(if (brl-related? message)    ; Bruce R. Lewis
              "users.sourceforge.net"   ; http://brl.sourceforge.net/
              "alum.mit.edu")]>