[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Dec 22 17:03:41 1992 
Subject:Re: List and Vector Syntax (long) 
From:Aaron Sloman 
Volume-ID:921222.02 

sfk@otter.hpl.hp.com (Steve Knight) writes:

> Date: 16 Dec 92 17:11:54 GMT
> Organization: Hewlett-Packard Laboratories, Bristol, UK.
>
> Continuing the thread on list and vector syntax ....
> .....
> The current syntax conflates two language roles -- quoting and
> sequence construction.  This runs against the solid grain of orthogonality
> that permeates the rest of POP-11.  Although we can conveniently build
> lists and vectors with quoted contents, we cannot conveniently put
> quoted items on the stack, for example.  The nearest idiom is
>     cons_with erase { this is a quoted collection of words }
>
> My view is that these two roles can and should be separated.  In POP-11
> we have too many distinct quoting contexts.  There are four quoting
> contexts in POP-11:
>
>     "word"          a lexical word enclosed in a pair of double-quotes
>     "'9*9'"         a string enclosed in a pair of double-quotes
>     [ ... ]         the interior of lists
>     { ... }         the interior of vectors
>
> Replacing these four different contexts by a single context, introduced
> by the '"' symbol is, to my way of thinking, a step towards the
> rationalisation of a language that is rapidly evolving away from
> beginners and towards experts, prepared to put up with useful, infrequent
> and obscure idioms.
>
> So instead of writing
>     cons_with erase { this is a quoted collection of words }
> I am suggesting the rather more obvious
>     "this is a quoted collection of words"

As I wrote in response to this suggestion posted by Chris Dollin,
there is an objection to this in that the word quote is itself a
lexical word and can be quoted, as in """, and since this is often
part of the process of constructing a list of text items for quoting
things the above proposal would need to be extended to cope with
quoted quotes.

Since the percent symbol cannot now occur at top level in Pop-11
except in the partial application syntax  foo(% a, b, c %) it might
be better to use the percent symbol to toggle between quoting and
non-quoting, as already happens inside lists. Then quoting """ would
be easy. Quoting "%" would, as now require some messiness, e.g.

    % foo ( %, "%", % a, b, c %, "%", % ) -> x %

would be equivalent to

    "foo", "(", "%", "a,", "b,", "c", ""%", ")", "->", "x"

I.e. quoting all text items in the expression

    foo(% a, b, c %) -> x

If the proposal for quoting multiple words were not restricted to
quotation within list expressions there's a further problem that you
would lose the current check that occurs if you leave out the second
quote. Pop-11 would go on reading to the end of the file and then
give you an obscure error message. (Just as happens now if you leave
out a closing list bracket, I admit!)

> ....POP-11 stands or falls by virtue
> of its reputation.  Improving the quality and reputation of POP-11 benefits
> everyone in the POP community over the long term.  Without this process of
> rationalisation, POP-11 will become an ever-increasingly complex and
> fragmented language.  So it is a cost that experts should be prepared to
> bear -- provided they agree the change is worthwhile!

OK I accept that by allowing a new syntax for quoting multiple text
items (e.g. use of %, or maybe ") some of the present convenience of
list expressions with lots of quoted words can be retained.

However, I suspect that as regards mis-features this issue of
quotation in list and vectore expressions is minor compared with
others, including letting commas be optional in variable
declarations (which should be phased out as soon as possible) making
input and output locals default to dynamic rather than lexical and
many other permitted alternative forms for the same thing, including
the dreadful toleration of "do" in place of "then" in unless
expressions:

    unless foo(x) do x else y endunless -> z

Aaron
---
-- 
Aaron Sloman, School of Computer Science,
The University of Birmingham, B15 2TT, England
EMAIL   A.Sloman@cs.bham.ac.uk  OR A.Sloman@bham.ac.uk
Phone: +44-(0)21-414-3711       Fax:   +44-(0)21-414-4281