home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / misc / 3699 < prev    next >
Encoding:
Internet Message Format  |  1992-11-15  |  9.1 KB

  1. Path: sparky!uunet!ornl!sunova!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!wupost!spool.mu.edu!agate!doc.ic.ac.uk!uknet!mcsun!sunic!psinntp!psinntp!dg-rtp!sheol!throopw
  2. From: throopw@sheol.UUCP (Wayne Throop)
  3. Newsgroups: comp.lang.misc
  4. Subject: Re: Pointers
  5. Message-ID: <721864322@sheol.UUCP>
  6. Date: 16 Nov 92 00:15:16 GMT
  7. References: <721539019@sheol.UUCP> <BxLyv1.CG4@mentor.cc.purdue.edu> <721626972@sheol.UUCP> <BxpsHo.MID@mentor.cc.purdue.edu>
  8. Lines: 168
  9.  
  10. : From: hrubin@mentor.cc.purdue.edu (Herman Rubin)
  11. : Message-ID: <BxpsHo.MID@mentor.cc.purdue.edu>
  12. : This is not a change in subject.  It is the question of whether one
  13. : is allowed to directly use the machine hardware, or whether one must
  14. : HOPE that the compiler writer considered what you are doing when the
  15. : compiler was produced.  
  16.  
  17. Nonsense.  Even if your notation is a pointer notation, you must HOPE
  18. that the compiler writer will translate that into the machine
  19. instructions you think are best for your task.  For a trivial example,
  20. "pointer" notation on popular PC architectures has been mapped into
  21. tiny, small, medium, large, huge, and various flavors of
  22. flat-32-bit-address-for-DOS implementations.  From the pointer notation
  23. alone, you can only hope that your translator for pointer notation
  24. chooses the "right" implementation.  In this respect, the difference
  25. between pointer and reference notations is completely irrelevant: they
  26. are IDENTICAL in this. 
  27.  
  28. The ONLY notations that map directly to the machine hardware are
  29. "assembly" notations.  Even such nearly-assembly-notations as PL/360
  30. have non-selectable machine semantics in their "higher level"
  31. constructs, and limitations in how they can translate expressions. 
  32.  
  33. If Dr.  Ruben insists on talking about high-level notations and
  34. machine-level details inextricably and confusedly, he will continue to
  35. be like somebody insisting on talking about phlogiston to a modern
  36. chemist.  In each case, experience proves that the language use is
  37. inappropriate to the subject matter. 
  38.  
  39. : What those who advocate keeping the user from
  40. : the machine are like those who would require people who take their 
  41. : cars into the shop for service to describe the problem to someone 
  42. : who does not understand automobile hardware.
  43.  
  44. I find a better analogy to be the sort of user who keeps talking about
  45. "carburator problems" and "maybe it's flooded" and "did you try the
  46. choke?" to a mechanic trying to fix the user's fuel injection system. 
  47. Or the user who insists on a new set of spark plugs for the user's
  48. diesel Audi.  Such a car user may understand driving (the application)
  49. and roads (the hardware) very well.  Nevertheless...
  50.  
  51. : Even HLLs have branches.  But I do know of architectures which are slowed
  52. : because they cannot use lookaheads with unconditional branches (gotos)
  53. : because the hardware does not recognize such a branch except as a case
  54. : of a conditional branch, and hence must consider both branches.  Is
  55. : removing pointers going to similarly weaken hardware?
  56.  
  57. Who said anything about "removing pointers" from hardware? Or "removing
  58. (recognizably) unconditional branches" from hardware, for that matter?
  59. In fact, I doubt that such silliness is *ever* done for language-inspired 
  60. reasons alone.  Certainly, in the inspired-by-language designs I'm
  61. familiar with, unconditional branches weren't ever on the chopping
  62. block.  Though I'd be glad to hear of specific counterexamples. 
  63.  
  64. : Are we going to allow the driver to use the steering wheel and the 
  65. : accelerator and brake, or just have a program to run the car?
  66.  
  67. The steering wheel and accelerator and brake are high-level interfaces.
  68. The better analogy would be allowing the user to time the ignition,
  69. tinker with the exhaust architecture, and so on.  And the answer is,
  70. yes, the users can do those things.  They just can't do them from
  71. the driver's seat and without getting grease on their hands.
  72.  
  73. : One major advantage of Arabic over Roman is that Arabic can usually
  74. : be written faster.  Are reference notations anywhere near as fast as
  75. : pointers?
  76.  
  77. Certainly.  Reference notations are *faster* than pointer notations (as
  78. notations), and I've already specified the main reason why: the fact of
  79. indirection is stated once, instead of being stated at every mention of
  80. the pointer/reference. 
  81.  
  82. And since they map to the same hardware operations, there IS no
  83. run-time speed issue.
  84.  
  85. But again, the claim raised was that the notation need not contain
  86. an explicit pointer notation in order to have efficient implementations
  87. of the notation which are expressive enough for function variables
  88. and other forms of delayed binding.  And the answer is very clear:
  89. explicit pointer notation is NOT needed for efficiency.
  90.  
  91. : I have likened this to using infix notation instead of prefix.  Those
  92. : who would restrict access to the machine except in some complicated
  93. : form, such as 99% of the current assembler languages, do not consider
  94. : syntax important.  But the only difference between Arabic numerals
  95. : and Roman numerals, or even writing out the expression for the numbers
  96. : in Sanskrit words, is syntax.
  97.  
  98. This is again confusing abstract notation issues with concrete
  99. implementation issues.  Postfix, prefix, or infix in a user-oriented
  100. notation have NOTHING to do with hardware implementation issues.  The
  101. popularity of prefix notations for intimate-with-the-machine notations
  102. is purely and simply a reflection of the fact that most machine istream
  103. formats ARE, INDEED, PREFIX FORMATS.  It has NOTHING to do with issues
  104. of whether "syntax is important" to the user or not.   It has to do with
  105. being able to express most nearly directly what's in the machine's istream.
  106.  
  107. Now, clearly one can define a higher-level notation that will correspond
  108. more closely to what humans "expect", and which will nevertheless have
  109. an exact translation into a machine istream.  Such things have been
  110. done, eg PL/360.  But this inevitably puts a layer between the programmer
  111. and the machine, however slim, and perhaps even more important, is
  112. misleading, because (using a PL/360 example)
  113.  
  114.               a := b + c * d;
  115.  
  116. did not mean what a human is most likely to take it to mean.
  117.  
  118. The bottom line is, either a notation expresses what a human means, ie
  119. what some abstract model means, OR it expresses what a machine means, ie
  120. what some concrete implementation means.  To try to do both at once is,
  121. essentially, impossible, because there are conflicting requirements of
  122. the two goals. 
  123.  
  124. : There IS a way to get some of this, and I have been assured by those
  125. : who supposedly know that this can even be done, and at not too great
  126. : a cost.  That is to allow a really powerful macro language, which 
  127. : would be a syntactical translator from what the user wants to write
  128. : to what some processor can read.  
  129.  
  130. Oh foo.  A saying about "teaching your grandmother to suck eggs" springs
  131. to mind, for some completely obscure reason. 
  132.  
  133. Yes, you can wave your hands and say "macros" and "syntactical
  134. translator" and perhaps "code generation".  Yes, these things "can be
  135. done", and even at "not too great a cost" (for some definitions of
  136. "done" and "not too great"). 
  137.  
  138. But what do you think providing such "macros" and "syntactical
  139. translations" IS besides writing (or enhancing) a compiler for a
  140. specific translation task?  There are a lot of little details behind that
  141. little unassuming "can be done".  There's even a standard phrase for it:
  142. SMOP (small matter of programming). 
  143.  
  144. : The translator can employ portable constructs without knowing how they
  145. : will be done, such as the obtaining of a geometric random variable and
  146. : updating the information so that the next time those bits used to
  147. : generate this random variable are not used.  This may or may not be a
  148. : function call.  Another is the example of unpacking I have used here;
  149. : this requires the use of relatively easily understood syntax, which the
  150. : current languages do not support.  At least I hope that most will not
  151. : find understanding a list of results as too hard. 
  152.  
  153. These two examples are of two rather drastically different things.  One
  154. is parsing a notation into operator/operand/reference in an orderly way,
  155. and the other is generating code for each specific operation. 
  156.  
  157. But yes indeed, there are many meta-notations which allow the
  158. specification of these two things, such as LEX/YACC grammar processors,
  159. or Lisp reader macros in the one case, or tree-driven code generators or
  160. specialized intermediate languages, or attributed grammars for the
  161. other, to name only a handful of techniques. 
  162.  
  163. And further, nothing stops anybody from *using* these techniques and
  164. notations for any language desired, from C to Lisp, or roll one's own,
  165. or whatever is wanted.
  166.  
  167. So what's the big deal? Seems to me that Dr Rubin can go ahead and start
  168. writing his macros and specifing his syntactic translations any time he
  169. pleases, in notations specifically designed to make this sort of thing
  170. easy.  Say, the Amsterdam compiler toolkit, or the UNC language lab, or
  171. any of the many, many metacompiler systems. 
  172.  
  173. Or hire the guys that say it can be done at "not too great a cost". 
  174. (Though I'd ask them to be a bit more specific about just what they
  175. could do for just how much money before *I'd* hire them...)
  176. --
  177. Wayne Throop  ...!mcnc!dg-rtp!sheol!throopw
  178.