Newsgroups: comp.lang.dylan,comp.lang.lisp,comp.lang.scheme
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!gatech!news.mathworks.com!tank.news.pipex.net!pipex!uknet!newsfeed.ed.ac.uk!edcogsci!jeff
From: jeff@cogsci.ed.ac.uk (Jeff Dalton)
Subject: Re: Parenthesized syntax challenge
Message-ID: <DGJx4L.Fsr@cogsci.ed.ac.uk>
Organization: Centre for Cognitive Science, Edinburgh, UK
References: <44aa9a$j5h@miso.cs.uq.edu.au>  <ppotts-2809951909280001@198.11.57.140> <OZ.95Oct10235418@nexus.yorku.ca> <45m10h$dl0@louie.disney.com>
Date: Mon, 16 Oct 1995 17:11:43 GMT
Lines: 71
Xref: glinda.oz.cs.cmu.edu comp.lang.dylan:5427 comp.lang.lisp:19535 comp.lang.scheme:14019

thant@disney.com (Thant Tessman) writes:

>In article <OZ.95Oct10235418@nexus.yorku.ca>, oz@nexus.yorku.ca
>writes:

>> interesting to note that there does not seem to be much research into
>> programming language syntaxes these days. [...]

>See "Extensible Syntax with Lexical Scoping" by L.Cardelli, F.Matthes,
>M.Abadi (1994) at:

>  http://www.research.digital.com/SRC/personal/Luca_Cardelli/Papers.html

>I *like* Lisp (actually Scheme) syntax, but for me this paper refuted
>the argument that parenthesized-syntax's overwhelming advantage over
>other syntaxes was the power that it gave macros.

Well, what exactly _is_ the refuted argument?

I think people sometimes make a too-simple claim that looks sort of
like this:

  Lisp syntax gives you program-as-data, and that gives you
  Lisp-style macros (which are far superior to substitution
  macros and the like).

Perhaps someone else can come up with a better version of this
argument, because when I do it I get something that's rather
unconvincing.  I've tried several variations, and they're all
about equally bad.  For instance, it's not enough that
"Lisp syntax gives...".  We need something more like "Only
Lisp syntax gives...".  Unfortunately, that's false if
what it supposedly gives you is program-as-data.  (Prolog
is one counterexample.)

Anyway, it seems to me that to get a good argument for the
advantage of Lisp syntax, you need something that's more complex
and that has a weaker conclusion.  So it won't conclude that
there's an overwhelming advantage or that only Lisp syntax
will do.  The conclusion will say something about a combination
of simplicity and power that, despite some problems, has been
very effective and that's at least difficult for other approaches
to equal.  Lisp's syntax contributes to the simplicity.

This is not to say that Lisp's syntax is _necessary_ or that there
cannot be other approaches that are, in some ways, better than Lisp's.
Other approaches tend to be more complex, or more restricted, in one
way or another.  Some may think that's a price worth paying in order
to get what they see as other advantages.  But this is an area where
there's no single Right Answer.

The Cardelli approach is a good example.  From the abstract:

  A frequent dilemma in programming languages design is the choice
  between a language with a rich set of notations and a small, simple
  core language. We address this dilemma by proposing extensible
  grammars, a syntax-definition formalism for incremental language
  extensions ans restrictions. The translation of program written in
  rich object languages into a small code language is defined via
  syntax-directed patterns. In contrast to macro-expansion and
  program-rewriting tools, our extensible grammars respect scoping
  rules.

That's very similar to what's done in Scheme and Dylan, and it is both
more restricted (e.g. Lisp macros allow you to use a pattern language
if you want, but they also allow other possibilities) and more complex
(e.g. you have to learn the pattern language and the implementation
has to implement it).  But it has compensating advantages such as
respecting scoping rules.

-- jeff
