home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / pop / 163 next >
Encoding:
Internet Message Format  |  1992-12-22  |  5.5 KB

  1. Path: sparky!uunet!pipex!bnr.co.uk!uknet!bhamcs!axs
  2. From: axs@cs.bham.ac.uk (Aaron Sloman)
  3. Newsgroups: comp.lang.pop
  4. Subject: Re: Syntax Misdesign
  5. Message-ID: <Bzo6DH.9uL@cs.bham.ac.uk>
  6. Date: 22 Dec 92 16:41:40 GMT
  7. References: <116670032@otter.hpl.hp.com> <BzBpvA.9F4@cs.bham.ac.uk> <KERS.92Dec16162724@cdollin.hpl.hp.com>
  8. Sender: news@cs.bham.ac.uk
  9. Organization: School of Computer Science, University of Birmingham, UK
  10. Lines: 140
  11. Nntp-Posting-Host: emotsun
  12.  
  13.  
  14. Concerning whether lists should by default quote their contents or
  15. not,
  16.  
  17. kers@hplb.hpl.hp.com (Chris Dollin) writes:
  18.  
  19. > Date: 16 Dec 92 16:27:24 GMT
  20. > Organization: Hewlett-Packard Laboratories, Bristol, UK.
  21.  
  22. (aaron)
  23. >    It's much easier where the default is quotation to have a single
  24. >    pair of brackets to unquote, than when the default is evaluation and
  25. >    lots of quotation marks are needed to quote. Of course, in Lisp you
  26. >    don't need lots of quotation marks as a prefix quotes the whole list
  27. >    expression.
  28.  
  29. (kers)
  30. > In Pepper I have taken the step Steve describes: the list and vector syntax do
  31. > *not* automatically quote. (Why should they?)
  32.  
  33. A rhetorical question is not an argument. If square brackets are
  34. defined as quoting then they should quote, if they are not defined
  35. as quoting they should not quote. The question is which happens more
  36. often, which is less misleading, more likely to lead to bugs, etc.
  37.  
  38. My contention was that if the default is not to quote then more
  39. typing errors will occur when people want to quote things. That's an
  40. empirical claim which could well be false.
  41.  
  42. (kers)
  43. > ....You want quotation, you quote
  44. > things, and a natural extension to Pop word-quotation is to allow *any* number
  45. > of items between quotes.
  46. >
  47. > Thus the Pop list [bill and ben the flowerpot men] becomes the Pepper list
  48. > ["bill and ben the flowerpot men"]. This means that it is not the case that
  49. > ``lots'' of quotation marks are needed to quote, at least in examples like
  50. > this.
  51.  
  52. That won't do as it stands, because the double quote symbol " is
  53. itself a word in Pop-11 and needs to be capable of occurring in a
  54. list. At present you can create lists like ["cat" -> x] which, if
  55. given to the compiler (previously to popval) will assign the word
  56. "cat" to x.
  57.  
  58. On the new notation, you'd have to do
  59.     [""", "cat", """, "->", "x"]
  60.  
  61. or
  62.     [""", "cat", """ "-> x"]
  63.  
  64. which is horribly confusing, unless a new convention were introduced
  65. e.g. that within a quoted context in list brackets "" refered to
  66. """. Then you could do
  67.  
  68.     ["""cat "" -> x"]
  69.  
  70. Given the frequency with which lists containing quoted words are
  71. created (e.g. in macros, etc.) I think this sort of thing is still
  72. intolerable.
  73.  
  74. An alternative would be to have lists non-quoting by default, but
  75. allow "%" to toggle quoting as it does now, except immediately
  76. after "(" and before ")", when it would signify partial application,
  77. as in
  78.  
  79.     maplist(% sqrt %)
  80.  
  81. So
  82.  
  83.     %cat dog mouse%
  84.  
  85. would become equivalent to
  86.  
  87.     "cat", "dog", "mouse"
  88.  
  89. Then the above example would be expressed thus
  90.  
  91.     [% "cat" -> x %]
  92.  
  93. which I think is much clearer!
  94.  
  95. (kers)
  96. > It gets a bit more irritating in expressions like:
  97. >
  98. >     [
  99. >     ["bill and ben and little weed"],
  100. >     ["andy and teddy and looby loo"],
  101. >     ["thomas the tank engine and friends"]
  102. >     ]
  103.  
  104. Which could become
  105.      [
  106.      [%bill and ben and little weed%],
  107.      [%andy and teddy and looby loo%],
  108.      [%thomas the tank engine and friends%]
  109.      ]
  110.  
  111. > Now you can get irritated (and I did) by the result of separating list and
  112. > vector syntax from quotation; sometimes, when you want to build a list that is
  113. > a mixture of quoted and unquoted material, it is a nusiance. But this is true
  114. > in Pop, too. And I will admit, I did spoil the purity of my position by
  115. > extending the quotation syntax to allow lists, vectors, and unquoted material
  116. > to appear within it. But the result -- that dropping into quotation mode is
  117. > signalled explicitly by quotation marks, which happen to allow list and vector
  118. > constructs within them -- is, I think, a rather nicer design.
  119.  
  120. It would be possible to allow % .... % to cause nested list and
  121. vector expressions all to be in quote mode by default, with embedded
  122. occurrences of % ... % to unquote.
  123.  
  124. (aaron)
  125. >    Probably one of the most serious misdesigns is that there's no good
  126. >    syntax for defining procedures that take different combinations of
  127. >    arguments, like, for example, newanyarray or newarray. You have to
  128. >    write horrible code to test what's on the top of the stack.
  129. >
  130. > Well ... I think the horrid code warns us about the horrid idea. I've always
  131. > been unhappy about procedures like newarray *because* they take different
  132. > numbers of arguments, the number being determined by the types of the ``fixed''
  133. > arguments.
  134.  
  135. I am inclined to agree with this, having just found a bug in Poplog
  136. common lisp due to the fact that giving newanyarray a list
  137. (including []) as the default item (i.e. the second, optional,
  138. argument) causes it to treat the list as the boundslist, i.e. the
  139. first argument. I think an alternative to newanyarray should be
  140. provided that always takes the same number of arguments, but maybe
  141. allows false, or undef to indicate that a default should be used.
  142.  
  143. Or maybe we need a unique record called default, of type default, so
  144. that isdefault(item) or item == default can be a test for such
  145. items, by analogy with isundef(item), or item == termin.
  146.  
  147. Aaron
  148. -- 
  149. Aaron Sloman, School of Computer Science,
  150. The University of Birmingham, B15 2TT, England
  151. EMAIL   A.Sloman@cs.bham.ac.uk  OR A.Sloman@bham.ac.uk
  152. Phone: +44-(0)21-414-3711       Fax:   +44-(0)21-414-4281
  153.