[mercury-users] Re: Lisp-like syntax for Mercury (Mercury & macros)

Richard A. O'Keefe ok at cs.otago.ac.nz
Wed Jun 12 11:12:52 AEST 2002


Milan Zamazal <pdm at zamazal.org> wrote:
	    RAO>     (define (foo
	    RAO>               (t1)      ; comment
	    RAO>               (t2)      ; comment
	    RAO>               (t3))     ; comment
	
	... which consumes a lot of lines, so you won't stop scrolling up and
	down all the time.

If you have a lot to say, then you need space to say it.  If you have
that much information, you're going to be scrolling ANYWAY, so you might
as well put as much information about a single item together with that
item as you can.
	    RAO> The average Lisp programmer writes more function calls than
	    RAO> data lists.
	
	I tried to write it this way at the first attempt (it's obvious when
	transcripting Mercury sources), but then I changed my mind.  The reason
	is that *term* is the different thing.  Lisp already has got (a lot of)
	lists notated in a very traditional way.  `define' and `case' are likely
	to be Lisp macros, while `(true)' and `(append As Ys Cs)' are not
	standard function nor macro nor special form calls in the Lisp sense.
	Moreover, when it is a just plain term not corresponding to any call
	(e.g. `ok(Result)'), then you would notate it as a list, while you would
	introduce a different non-Lisp notation for lists.
	
I completely disagree.  My suggestion is precisely that square bracket
notation should be used for lists, and round parenthesis notation should
be used for other compound terms, goals included.  So a plain term such
as 'ok(Result)' I would notate as '(ok Result)', ******NO****** as a list.

I did note that Interlisp and some Schemes (notably Chez Scheme)
allow square brackets for lists, so using square brackets for lists,
while uncommon, is not "non-Lisp notation for lists".

While (define ...) and (case ...) are "special forms", the macros (if
macros they be) that implement them would not be the macros that Lisp
uses.  Since normal Lisp function calls and normal Lisp macro calls
and normal Lisp special forms would not appear in Lispy-Mercury,
I don't see their relevance, other than analogy.

Prolog has control structurs that use normal term syntax,
such as setof/3.  I don't see any difficulty with control structures
having normal term syntax in Lispy-Mercury.

I repeat:  having written Scheme code very frequently over the last few
years, I find that almost all uses of parentheses in my Scheme code are
for function calls, special forms, or macro calls, PRECISELY corresponding
to Prolog term syntax, and a very small proportion are for lists.

Indeed, back in the days when I used to be able to read comp.lang.scheme,
there was a serious proposal that Scheme implementations (with normal Lispy
syntax) without any support at all for the list data-type would be quite
useful.  The one thing they couldn't work around was rest arguments, so
the proponents of list-free Scheme were requesting a more abstract
interface to rest arguments (rest-length and rest-ref, or something like
that).

	When you look at it that way, how would you use backquote then without
	introducing a lot of confusion?  (I'd certainly like to use regular
	backquote in the Lisp syntax.)
	
What woudl you want explicit backquotes for?

	    RAO> The "?" notation is hardly Paul Graham's
	
	But I still don't like it. :-)
	
De gustibus non disputandum est.
	Nevertheless, I'm afraid the problem is that Mercury is much
	more complex language than Prolog.

That's certainly true.

	(ISO) Prolog itself wouldn't motivate me to
	look for another syntax, its syntax is readable.

Hah.  A certain member of the BSI Prolog committee, whose company made
a non-Edinburgh Prolog, tried to sell the BSI committee on the idea of
Edinburgh syntax with non-Edinburgh semantics.  Because that committee
was not at that time overburdened with people familiar with Prolog,
they very nearly bought it.  We could have ended up with a Lispy ISO Prolog...

	SomeProgrammersLikeWritingLikeThis.However,IDontThinkThisFormOfCommunicationIs\
	AGoodIdea.IApologizeToAllWhoCantReadMyTextsWrittenInATraditionalStyle.

As a Smalltalk fan, I feel some guilt by association for the way that
baStudlyCaps has crept into OO languages.  Smalltalk had to use baStudlyCaps
because they used a hybrid of ASCII 63 and ASCII 67, where there were lower
case letters, but _ and ^ were left arrow and up arrow.  They didn't use
underscores in Smalltalk names because they _couldn't_.

("ba" is of course an African gender prefix.)

--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list