Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!gatech!howland.reston.ans.net!paladin.american.edu!news.ecn.uoknor.edu!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjh
From: fjh@munta.cs.mu.OZ.AU (Fergus Henderson)
Subject: Re: Prolog syntax
Message-ID: <9512302.17646@mulga.cs.mu.OZ.AU>
Sender: news@cs.mu.OZ.AU (CS-Usenet)
Organization: Computer Science, University of Melbourne, Australia
References: <9511221.23905@mulga.cs.mu.OZ.AU> <3nkjnc$q0o@goanna.cs.rmit.edu.au> <9511918.22753@mulga.cs.mu.OZ.AU> <3o54fq$bgf@goanna.cs.rmit.edu.au>
Date: Tue, 2 May 1995 16:49:54 GMT
Lines: 101

ok@goanna.cs.rmit.edu.au (Richard A. O'Keefe) writes:

>(I should point out that I have a lot of respect for Fergus Henderson and
>everyone in the Mercury project.  Read what follows in the light of that.)

Thanks.  The respect is mutual.  And thank you for responding to my
posts in this thread, your answers have certainly been enlightening.

>I think you will agree that whatever background experience you have with
>* and + it is that makes you think * + * anomalous, it does not apply
>to the plain words 'insert' and 'delete'.  I at least _hope_ that you will
>agree that there is no good reason why
>	?- X = (insert / delete).
>should be rejected by a Prolog system. 

I'm afraid I have to disappoint you: if `insert' and `delete' have been
declared as operators, I do think that it would be reasonable to reject
that input.

>BUT NU PROLOG DOES REJECT IT!

Yes, but NU-Prolog does a lot of silly things, such as rejecting
"?- X is 1*(2+3).", so using NU-Prolog as an example is not a
particularly strong argument ;-)

I think the blame for the problem of NU-Prolog rejecting
"insert/delete" could reasonably be placed on NU-Prolog's overly large
table of builtin operators, not on the NU-Prolog parser's rejection of
"(<prefix-op> <infix-op> <prefix-op>)".

>>Distinguishing between + and '+' is not _necessary_, but I think it might
>>produce a syntax that was easier for humans to understand.  Humans do
>>notice such distinctions.
>
>Some people call it the principle of mediocrity, others call it
>xxxx-centricity:  you are assuming that you are typical of 'humans'.

I was making the assumption that my own experiences and the experiences
of others that I have witnessed are typical (at least in that
particular respect I was addressing).  Now to be sure, inductive
reasoning of this sort is by no means certain, but it is necessary to
use it in order to make progress.  Fortunately, by posting to
comp.lang.prolog I can reach a wide and relatively diverse audience who
are sure to shoot down any such generalizations that turn out to be
ill-founded ;-)

With regard to my particular claim that "humans do notice such
distinctions", it is certainly true that almost all humans notice such
distinctions some of the time, and that some humans notice such
distinctions almost all of the time.  So I do not think the claim
is unreasonable.

>It would be *very* interesting if someone would do a real psychological
>study to *test* whether distinguishing between + and '+' makes things
>easier for 'humans', but unless and until something of the sort is done
>and published, the claim is worthless except as an expression of your
>own taste.

I agree that such studies would be interesting, but in their absence
the best we can do is look at personal experiences and anecdotal evidence.

Unfortunately arguments about syntax do often end up hinging on
each individual's sense of aesthetics.

>>It is true that requiring operators to be unquoted would mean that
>>there are some atoms which cannot be operators.  I don't think this is
>>a big loss, however, since I have never seen a Prolog program which
>>used quoted atoms as operators
>
>This is a limitation on your experience, not on the world.
>As it happens, my experience is different from yours.
>
>>and I have trouble imagining a
>>situation in which doing so would improve readability.
>
>This is a limitation on your imagination, not on the world.

Yes, certainly.  I was interested to see if any of the readers of
comp.lang.prolog could think of some example that I had not
imagined.

>But as Roger Scowen has pointed about, operators are concerned with
>read/1 and write/1, which are *run-time* things which should not have
>anything to do with any module system.  Why should the syntax of
>external data be affected by which module happens to contain the call
>to read()?

I don't think it should be.  Operators can effect both the source
code syntax and the external data syntax, but I do not think that
those two effects should be acomplished by a single mechanism.

>The right answer to variable run-time syntax is to generalise the idea
>of read tables to syntax tables, and to have versions of read/1 and
>write/1 that take syntax tables as arguments.

Yes, I agree.

-- 
Fergus Henderson                       | I'll forgive even GNU emacs as
fjh@cs.mu.oz.au                        | long as gcc is available ;-)
http://www.cs.mu.oz.au/~fjh            |             - Linus Torvalds
