home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / scheme / 1972 < prev    next >
Encoding:
Text File  |  1992-07-23  |  3.9 KB  |  81 lines

  1. Newsgroups: comp.lang.scheme
  2. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!udel!louie!hercules.cis.udel.edu!carroll
  3. From: carroll@hercules.cis.udel.edu (Mark C. Carroll)
  4. Subject: Re: Abelson&Sussman; Lisp vs C in Compilers/Prog. Lang class; etc.
  5. Message-ID: <1992Jul23.200958.18546@udel.edu>
  6. Sender: usenet@udel.edu (USENET News Service)
  7. Nntp-Posting-Host: hercules.cis.udel.edu
  8. Organization: University of Delaware, Newark
  9. References: <865.9207201558@subnode.aiai.ed.ac.uk>
  10. Date: Thu, 23 Jul 1992 20:09:58 GMT
  11. Lines: 68
  12.  
  13. In article <865.9207201558@subnode.aiai.ed.ac.uk> jeff@aiai.edinburgh.ac.UK (Jeff Dalton) writes:
  14. >> Date: 16 Jul 92 20:36:04 GMT
  15. >> From: "Mark C. Carroll" <carroll@hercules.cis.udel.edu>
  16. >
  17. >> The main distinguishing characteristic of SML is that it is an
  18. >> exceptionally strongly statically typed language. The typing system is
  19. >> considered to be an absolutely godsend to some people (like me), and
  20. >> an absolutely abomination by others. 
  21. >> 
  22. >> For writing a system like a compiler, I find that the overwhelming
  23. >> majority of errors that I tend to make are captured by the ML
  24. >> typechecker, so that when I finally get a module to typecheck, that
  25. >> module works perfectly. (For more general types of programming,
  26. >> typechecking will catch some, but not all bugs. But as I said, in a
  27. >> compiler, the kind of errors that people seem to make are almost
  28. >> always revealed during the typecheck.)
  29. >
  30. >Note that you've gone from "some people (like me)" and "the majority
  31. >of errors I make" to "in a compiler ... the kind of errors people seem
  32. >to make".
  33. >
  34. >But I've just been working on some compilers, and type checking
  35. >wouldn't have helped _me_ very much (at least not this time), so
  36. >I have some doubts about your generalization.
  37. >
  38.  
  39. Well.. first, have you ever worked with an ML-like type system?
  40.  
  41. If you're only typing experience is with Pascal/Ada, then you're
  42. certainly going to think that typing systems are not useful in a
  43. compiler. But the SML type system is very different... 
  44.  
  45. In a compiler, the typical errors seem to come from abusing the data
  46. structures - things like performing some kind of manipulation of the
  47. parse tree on a parse tree node where it's innappropriate, or
  48. inconsistencies in the handling of the intermediate form accross
  49. different constructs, etc. In a typing system like Ada, you probably
  50. won't catch that kind of error. In SML, it always catches you.
  51.  
  52. In effect, for a compiler type project, typing becomes almost a system
  53. of checked assertions insuring that calls are consistent. In both my
  54. own compilers, and in all of the compilers that I've seen by other
  55. people, it seems that the majority of errors (with the exception of
  56. errors in the generated code) are caused by inconistency within the
  57. manipulation of the internal data structures. 
  58.  
  59. If I'm wrong with respect to your personal style of compiler
  60. programming, I'm sorry. I'm speaking from very empirical evidence, and
  61. it's certainly possible that I've read a cluster of very non-typical
  62. compilers. Obviously, I don't believe that that's the case, but hey,
  63. even I can be wrong sometimes :-). (And, of course, in any case,
  64. things like this are _never_ universal. The best language to write a
  65. compiler depends not just on the compiler being written, but on the
  66. compiler author. A language that it perfect for me to write a compiler
  67. in could be the worst possible language for you to write the same
  68. compiler in.)
  69.  
  70.     <MC>
  71.  
  72. [ Mark Craig Carroll <MC> ] You say you know no tricks, have no talents -
  73. [ U of Delaware, CIS Dept ] Isn't everyone supposed to have their own?
  74. [ Grad Student/Lab Hacker ] Yes, but few are obvious. Few draw notice to those
  75. [ carroll@udel.edu        ] who posess them, like flags waving themselves.
  76. -- 
  77. || Mark Craig Carroll: <MC>     ||"I live to see my fondest dreams realized,
  78. || Univ of Delaware, Dept of CIS|| Of living under the sights and sounds of
  79. || Grad Student/Labstaff Hacker || the gifted, Who gave so much to me"
  80. || carroll@udel.edu             ||   - _Feed_the_Fire_, Happy Rhodes
  81.