home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / acorn / tech / 54 < prev    next >
Encoding:
Internet Message Format  |  1992-08-16  |  6.0 KB

  1. Path: sparky!uunet!cs.utexas.edu!swrinde!sdd.hp.com!hpscdc!hplextra!otter.hpl.hp.com!hpltoad!cdollin!kers
  2. From: kers@hplb.hpl.hp.com (Chris Dollin)
  3. Newsgroups: comp.sys.acorn.tech
  4. Subject: Re: New Language/Compiler (ideas wanted)
  5. Message-ID: <KERS.92Aug17083517@cdollin.hpl.hp.com>
  6. Date: 17 Aug 92 07:35:17 GMT
  7. References: <1195@grun.is> <1992Aug17.132929.10141@waikato.ac.nz>
  8. Sender: news@hplb.hpl.hp.com (Usenet News Administrator)
  9. Organization: Hewlett-Packard Laboratories, Bristol, UK.
  10. Lines: 127
  11. In-Reply-To: bwc@waikato.ac.nz's message of 17 Aug 92 13:29:29 +1200
  12. Nntp-Posting-Host: cdollin.hpl.hp.com
  13.  
  14. In article ... bwc@waikato.ac.nz (Ug!) writes:
  15.  
  16. |    Halfdan Ingvarsson asks for ideas on new language features.
  17. |
  18. |    (deep breath)  Hokay, here we go:
  19. |
  20. |    Firstly, have a look at Oberon-2.  The descriptions are available 
  21. |    by anonymous ftp from ETH.  Some really neat ideas there.
  22.  
  23. Make sure you've looked hard at Lisp, Scheme, and Pop11 too. The pure
  24. functional languages are also a good source of ideas.
  25.  
  26. | Generics. Any new language worth its salt should consider this
  27. | issue. One of the reasons why Ada beats C++ for productivity is
  28. | that generics beats object oriented for reuseability.  (the
  29. | other reasons have to do with the great tools that come with
  30. | Ada, and the strict licensing scheme which ensures
  31. | compatability)
  32.  
  33. C++ *has* generics, although they call them ``templates'', they were added
  34. late in the day, they have a horrid syntax [*1], and they silently explode
  35. your code for you.
  36.  
  37. | Subranges.  At some stage I'd love to build a language which has
  38. | *no* concept of fixed data-type sizes.  Of course, you could
  39. | then have a library routine which defines a type Word (much like
  40. | Modula-2's System.WORD) and Byte and so forth.  However, this is
  41. | entirely a portability concept, and so is not really applicable
  42. | to what you are trying to do, but even so, just think how nice
  43. | it would be to be able to use 320-bit integers...
  44.  
  45. Lisp. Scheme. Poplog Pop11. Smalltalk. Don't forget ratios and complexes.
  46.  
  47. | Overloading.  Ada has this, without being Object-oriented.  This
  48. | coupled with generics gives you better reuseability than object
  49. | instantiation. Both functional and operator please.  Don't worry
  50. | about redefining operator precedence:  leave 'em as they are,
  51. | and folks can work with that.
  52.  
  53. Common Lisp + CLOS has this. If you want to do it properly, allow
  54. user-definable operator *symbols*, don't restrict them to built-in operators
  55. (both Ada and C++ have this totally unnecessary restriction). [User-definable
  56. precedence is, sadly, a Bad Idea.
  57.  
  58. | One of the things I would like is a 'string' concept, which
  59. | automatically handles groups (arrays) of items which grow and
  60. | shrink - maybe a 'bag'.  In this way you could have a 'STRING OF
  61. | CHARACTER' or a 'STRING OF INTEGER'. 'STRING', like 'ARRAY'
  62. | allocates space, but it can be resized etc dynamically.  Useful.
  63.  
  64. Lists. Sets. Hash tables (both content and address based).
  65.  
  66. | Projection.  See previously mentioned Oberon-2.  This completely
  67. | redefines the way inheritance and stuff works.  Keeps the
  68. | language procedural rather than data-driven, which is nice for
  69. | those of us who think in processes, not in data-flows.  Coupled
  70. | with generics, should make life very interesting. Also, by
  71. | combining with overloading gives similar capability to object-
  72. | oriented, although dynamic binding might be tricky to fudge.
  73.  
  74. | Packages or Modules or *something*!  Preferably coping
  75. | automatically with linking (C... yuck!).
  76.  
  77. Yes.
  78.  
  79. | No limitations like 'strings can only be up to 255 in length'.
  80. | Yuck!
  81.  
  82. The restriction I have in mind for my language Pepper is that no object can
  83. have a length bigger than that which will fit in a fixnum (an immediate-value
  84. integer), which limits them to 2^29 elements. This limits bit arrays to 64Mb.
  85. Fortunately this restriction seems unlikely to bite for a few years yet.
  86.  
  87. | There is no number 8.
  88.  
  89. Ahem. I deleted the section numbers when I reformatted the message.
  90.  
  91. | Can link up with C, including C I/O.
  92.  
  93. Yes, cross-calling in some manner is essential. What's more difficult -- but
  94. necessary in the long run -- is to give C some way of calling *your* routines.
  95.  
  96. | A good 'ABSTRACT' (or opaque) data type.  Modula-2 almost does
  97. | it, but not quite, since it limits the size of its opaque types
  98. | to the size of a pointer.  Ada goes one better, but then
  99. | requires you to say what's actually in it, so what's the point?
  100. | Opaque data types enable data-hiding (great for abstraction
  101. | purposes), and are all too often very useful.  In C, I kludge
  102. | this by passing back a pointer to the type as a 'void *'.
  103.  
  104. I'd vote *against* abstract data types and *for* a simple but powerful module
  105. structure. After all, all ADTs do is to restrict the names that the user is
  106. allowed access to -- they're not allowed to use the representational names,
  107. eg, the fields of a structure; rather, they have access via a set of
  108. procedures. But this is just what modules are for, so why conflate the two
  109. concepts? [C++ does this with classes, and look at the resulting mess.]
  110.  
  111. Have we said ``Garbage collection'' yet? Have garbage collection. Have Garbage
  112. Collection. HAVE GARBAGE COLLECTION.
  113.  
  114. Words of advice:
  115.  
  116. Read Hoares ``Hints on Programming Language design''.
  117.  
  118. Favour simplicity of explanation over simplicity of implementation.
  119.  
  120. Make it easy to relate different language structures.
  121.  
  122. When in doubt, throw it out.
  123.  
  124. Avoid designing your first language. Experience shows that the second and
  125. subsequent ones are better.
  126.  
  127. Programmers should not design languages; they're too close to the problem, and
  128. want features that make some of their pet hates easier to cope with.
  129.  
  130. Non-programmers should not design languages; they have no idea what kinds of
  131. things should go into a language.
  132.  
  133. Always have someone else critique your language. You don't have to do what
  134. they say, but listen carefully to what they *do* say.
  135.  
  136. [*1] For compatability with the rest of the language.
  137. --
  138.  
  139. Regards,    | "Layered protocols give the software implementor a chance to
  140. Kers.       | ruin his performance in each layer." - Don Gillies
  141.