home *** CD-ROM | disk | FTP | other *** search
- From: kers@hplb.hpl.hp.com (Chris Dollin)
- Date: Wed, 16 Dec 1992 16:27:24 GMT
- Subject: Re: Syntax Misdesign
- Message-ID: <KERS.92Dec16162724@cdollin.hpl.hp.com>
- Organization: Hewlett-Packard Laboratories, Bristol, UK.
- Path: sparky!uunet!europa.asd.contel.com!emory!swrinde!cs.utexas.edu!sdd.hp.com!hpscit.sc.hp.com!hplextra!otter.hpl.hp.com!hpltoad!cdollin!kers
- Newsgroups: comp.lang.pop
- References: <116670032@otter.hpl.hp.com> <BzBpvA.9F4@cs.bham.ac.uk>
- Sender: news@hplb.hpl.hp.com (Usenet News Administrator)
- Lines: 73
- In-Reply-To: axs@cs.bham.ac.uk's message of 15 Dec 92 23:13:58 GMT
- Nntp-Posting-Host: cdollin.hpl.hp.com
-
- In article ... axs@cs.bham.ac.uk (Aaron Sloman) writes:
-
- In Pop-11 if you want to evaluate a bit of text to get one element
- you have to do just:
-
- [%f(x)%]
-
- It's much easier where the default is quotation to have a single
- pair of brackets to unquote, than when the default is evaluation and
- lots of quotation marks are needed to quote. Of course, in Lisp you
- don't need lots of quotation marks as a prefix quotes the whole list
- expression.
-
- In Pepper I have taken the step Steve describes: the list and vector syntax do
- *not* automatically quote. (Why should they?) You want quotation, you quote
- things, and a natural extension to Pop word-quotation is to allow *any* number
- of items between quotes.
-
- Thus the Pop list [bill and ben the flowerpot men] becomes the Pepper list
- ["bill and ben the flowerpot men"]. This means that it is not the case that
- ``lots'' of quotation marks are needed to quote, at least in examples like
- this.
-
- It gets a bit more irritating in expressions like:
-
- [
- ["bill and ben and little weed"],
- ["andy and teddy and looby loo"],
- ["thomas the tank engine and friends"]
- ]
-
- but not, I think, significantly more so. As a quick bit of false statistics,
- I went through about 13K lines of Pop in my Play directory. Just over 1100
- lines had list brackets (excluding lines using []); 380 of those used % and 279
- used ^, so well over half of those lists needed unquoted material in them.
- (Only 141 lines used vector brackets, with unquotes appearing in over 90 of
- those lines.)
-
- NOTE WELL these figures are distorted by multi-line expressions and multiple
- expressions per line. But they are suggestive.
-
- Now you can get irritated (and I did) by the result of separating list and
- vector syntax from quotation; sometimes, when you want to build a list that is
- a mixture of quoted and unquoted material, it is a nusiance. But this is true
- in Pop, too. And I will admit, I did spoil the purity of my position by
- extending the quotation syntax to allow lists, vectors, and unquoted material
- to appear within it. But the result -- that dropping into quotation mode is
- signalled explicitly by quotation marks, which happen to allow list and vector
- constructs within them -- is, I think, a rather nicer design.
-
- Probably one of the most serious misdesigns is that there's no good
- syntax for defining procedures that take different combinations of
- arguments, like, for example, newanyarray or newarray. You have to
- write horrible code to test what's on the top of the stack.
-
- Well ... I think the horrid code warns us about the horrid idea. I've always
- been unhappy about procedures like newarray *because* they take different
- numbers of arguments, the number being determined by the types of the ``fixed''
- arguments. I think this is one place where the open stack can become a road to
- hell. (I'm happy with procedures that take a counted argument, such as
- consstring; I'm less happy with consword, even though I implemented the same
- interface in Pepper -- partly for efficiency in the lexical analyser! Perhaps
- the advent of a suitable typechecker will assuage my fears. But more of that in
- another note, probably after Christmas.)
-
- PS When I left him, Steve was just coming to the boil.
-
- We need a syntax that uses patterns to handle the different cases.
- (Like prolog?)
- --
-
- Regards, Kers | "Once I would have been glad to have made your acquaintance
- Renaissance: | Now I feel the danger brought about by circumstance."
-