home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / misc / 4029 < prev    next >
Encoding:
Text File  |  1992-12-14  |  10.6 KB  |  218 lines

  1. Newsgroups: comp.lang.misc
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!udel!louie!nori.cis.udel.edu!carroll
  3. From: carroll@nori.cis.udel.edu (Mark C. Carroll)
  4. Subject: Re: Safety.  Was: Re: Pointers
  5. Message-ID: <1992Dec14.224239.1213@udel.edu>
  6. Sender: usenet@udel.edu (USENET News Service)
  7. Nntp-Posting-Host: nori.cis.udel.edu
  8. Organization: University of Delaware, Newark
  9. References: <Bz0Iy5.A9K@mentor.cc.purdue.edu> <724312516@sheol.UUCP> <Bz9FL2.9rp@mentor.cc.purdue.edu>
  10. Date: Mon, 14 Dec 1992 22:42:39 GMT
  11. Lines: 205
  12.  
  13. In article <Bz9FL2.9rp@mentor.cc.purdue.edu] hrubin@pop.stat.purdue.edu (Herman Rubin) writes:
  14. ]In article <724312516@sheol.UUCP> throopw@sheol.UUCP (Wayne Throop) writes:
  15. ]
  16. ]            .................
  17. ]
  18. ]]I have not seen any posting in which Herman explains *why* he does not
  19. ]]consider unions an adequate way to specify type punning, despite having
  20. ]]seen the claim that they *aren't* adequate several times.  (Type coercions
  21. ]]are something else, in standard usage.)
  22. ]
  23. ]ANYTHING which suggests to the compiler that something is to be stored when
  24. ]it does not have to be is not adequate.  
  25.  
  26. First of all: no compiler is actually going to do that store.
  27. Literally: I would project that there is not one single compiler
  28. (other than undergraduate class projects) that would actually do the
  29. store. So what's the big deal? Ugly syntax. Yes, it's ugly. But that's
  30. what macro processors are for. Get yourself m5 or TXL or even Perl, and
  31. the ugly syntax goes away.
  32.  
  33. ]Also, there are problems if one
  34. ]type of object is, say, 32 bits, and another 64 bits.
  35.  
  36. That's _exactly_ the problem. Programming languages are supposed to be
  37. unambiguous. What happens if the sizes are wrong? What does it mean to
  38. mask a sixty-four bit float into a 32 bit int? That _is_ an ambiguous
  39. operation. If you want to do it, the compiler _should_ force you to go
  40. through the machinery to explain exactly what you mean.
  41.  
  42. ]]-- begin excerpt from <723522717@sheol.UUCP] --
  43. ]] : Telling the compiler that that number which you used as an integer before
  44. ]] : is now to be considered a float is not ambiguous, except that most of the
  45. ]] : current languages will object strongly.
  46. ]
  47. ]] "Most of the current languages" object strongly because THEY HAVE
  48. ]] NO SUCH OPERATION.  Herman is simply using an operation that is
  49. ]] MEANINGLESS IN THE LANGUAGE.
  50. ]
  51. ]If a hardware operation, or even a "natural" operation which is somewhat
  52. ]more complicated, is not in the language, the language is excessively 
  53. ]weak if it cannot be adjoined so as to take into account hardware 
  54. ]capability.  The only language I know which has this operation explicitly
  55. ]is Galaxy. 
  56.  
  57. Most applications don't _care_ about hardware capability. 
  58.  
  59. For most applications, the speed of their compiled code is more than
  60. adequate without worrying about machine level bit-twiddling. The
  61. overwhelming majority of the time, the time that it would take to
  62. hand-optimize a piece of code can't be justified in terms of the speed
  63. difference. What's the point of cutting even 1000 machine cycles
  64. (which is generally _far_ greater than the actual amount that could be
  65. saved) out of a procedure, if the user doesn't notice a delay, and the
  66. program spends most of its time idle, waiting for inputs?
  67.  
  68.  
  69. ]There was an attempt in the 1930's to introduce a language called
  70. ]"Basic English" which eliminated most of the verbs in English, as well
  71. ]as other features.  It never caught on.  Languages should be arbitrarily
  72. ]extensible.  If humans can conceive of an operation, it should be
  73. ]possible to add that operation to the language with little problem.
  74.  
  75. First of all, natural languages are very different from programming
  76. languages (just ask my poor office-mates, all of whom do NLP). The fact
  77. that something is useful in natural language doesn't mean that it should
  78. be included in programming language. (For example, ambiguity can be used
  79. to create very beautiful poetic images in natural languages, whereas it
  80. creates a mess in programming languages.)
  81.  
  82. And the _vast_ majority of programming languages allow you to add
  83. _any_ operation to the language that makes sense under the comptuation
  84. model used by the language. It's generally called either a function or
  85. a procedure. (Type punning in Haskell is impossible, because it makes
  86. absolutely no sense in the model of the language. But that's not a bad
  87. thing about Haskell - Haskell is a very fine language for it's
  88. intended domain.)
  89.  
  90. And if you don't like function/procedure call syntax, you have exactly two
  91. choices: either <a] choose a language that has flexible operator
  92. syntax (like, for instance, Lisp or SML), or <b] use a macro processor
  93. like TXL that will allow you to transform out any operator use into an
  94. equivalent function call. (And if you start up your nonsense about how
  95. "operators are faster than functions", I'm going to get really angry,
  96. because it has been explained to you dozens of times that they
  97. aren't.)
  98.  
  99. ]The same holds for types; the C++ classes are really types, and the
  100. ]C typedef should have been called typealias.  Even prior to C, there
  101. ]were implementations of Fortran which allowed additional types.
  102.  
  103. Oh, come on, Herman. As has been said before: Class, in
  104. Object-oriented languages has a specific meaning, distinct from the
  105. conventional meaning of type, and C++ classes hold to that meaning
  106. precisely. It's an appropriate name, and besides that, IT DOESN'T
  107. REALLY MATTER! 
  108.  
  109. ]]While I'm at it, I'd appreciate any explanation for Herman's
  110. ]]position on "first course" exposure:
  111. ]
  112. ]]-- begin additional excerpt --
  113. ]] : Possibly the situation would eventually improve if CS students, in their
  114. ]] : FIRST course, would be placed in situations where their code would crawl
  115. ]] : unless they did such things.
  116. ]
  117. ]] Why should their FIRST course introduce them to situations
  118. ]] that are strikingly atypical of most software development?
  119. ]
  120. ]This is a chicken-and-egg phenomenon.  Most software development does
  121. ]not do certain things because the languages, compilers, and the training
  122. ]of the programmers does not mention them. 
  123.  
  124. How often is type punning necessary in production software
  125. development? It doesn't come up in the overwhelming majority of
  126. programming situations. Why in the world should you teach something in
  127. the FIRST COURSE that is useless in anything that the overwhelming
  128. majority of the class will _ever_ do in their careers? Wouldn't it be
  129. smarter to teach them something that they'll all need to know?
  130.  
  131. ] ... Political correctness is bad
  132. ]even in political situations.  What proportion of current programmers,
  133. ]even those who have had "advanced" courses, are aware of the important
  134. ]mathematical types of fixed point (NOT integer) and rational?  How many
  135. ]of them would think of including them?
  136.  
  137. Why is it political correctness? You just go around making these
  138. stupid accusations: justify it. Prove to us that it's useful outside
  139. of your specific problem area. Give me _some_ reason to justify
  140. including your things in my language. I haven't seen a single
  141. convincing reason of why I'd want to add it.
  142.  
  143.  
  144. ]...  There are many situations in
  145. ]which floating point is a guaranteed way to have problems, and the 
  146. ]person who starts out thinking that the type list of languages such
  147. ]as C are adequate will have a lot of unlearning to do to be able to
  148. ]do a good job in those numerous cases where C is inadequate.  Unlearning
  149. ]provides major obstacles for students in mathematics and statistics, and
  150. ]I see no good reason why CS and programming languages should be any
  151. ]different in this matter.
  152.  
  153. I certainly don't think that the type system of C is adequate - but
  154. then, I don't use C. I tend to use languages like Modula-3, Scheme,
  155. and SML. Their type systems have allowed me to easily do everything
  156. that I've needed. I don't write statistical software packages, so I
  157. don't know what kind of operations you need - and I don't care too
  158. much, because I don't think that there are many people who need the
  159. same things you do.
  160.  
  161. But try this: post an article to the net, describing _exactly_ what
  162. you need. Learn enough about compilers and languages to u
  163. nambiguously, intelligently describe what it is that will do the job
  164. for you. Explain it without any insulting invective. Be clear, and
  165. provide examples. I'll bet that someone will create it for you. Hell,
  166. if you give me an intelligent, complete, understandable explanation of
  167. what you want, I'll implement it for you!
  168.  
  169. ]The student who takes a typical cookbook mathematics course seems to
  170. ]be farther away from eventually understanding than the one who starts
  171. ]out with the concepts and theory.
  172. ]
  173. That's exactly our point. You want us to introduce cookbook techniques
  174. like type-punning in the first semester. We don't want that; we want
  175. to introduce the concepts and the theory, and _then_ let the students
  176. discover the techniques after they understand what they're doing.
  177.  
  178. ]] Well, Herman's hope is:
  179. ]
  180. ]] : This might cause more language producers and hardware designers to
  181. ]] : realize that there can be large costs with separate integer and floating
  182. ]] : registers, and that Boolean operations on floating numbers do make sense. 
  183. ]
  184. ]] It is possible that the cause (ie: early introduction of atypical
  185. ]] application-specific difficulties) would have this effect (having
  186. ]] undue attention payed to niche requirements).  It is not clear
  187. ]] that this is a good thing, however.
  188. ]
  189. ]Political correctness, again.  There is the standing joke about the
  190. ]mathematician and the physicist producing hot water.  In the second
  191. ]case, the mathematician turns things off to reduce to the previous
  192. ]case.  The CS student, or programmer, who can only think in terms
  193. ]of the C types, and strict typing, is in this rut.  While mathematicians
  194. ]do not in fact act this way, these guys are really stuck.
  195.  
  196. It's not political correctness; it's what WORKS, for the overwhelming
  197. majority of applications that any of us ever deal with. You exist in a
  198. tiny little niche, with requirements that are terribly different from
  199. those of the rest of the world. What's good for you is _not_ what will
  200. be good for everyone else. (And, admittedly, what's good for other
  201. application areas isn't good for you. But instead of learning enough
  202. to tell anyone what you need. 
  203.  
  204. And please, stop holding up C as the classic example of a computer
  205. science language. C is a dreadfully designed language, and hardly what
  206. I'd hold up as a fine example of language design by computer
  207. scientists. Try looking at a language like Modula-3 (if you like
  208. imperative languages) or SML (if you like more functional languages)
  209. to see the applications of principles of CS language design.
  210.  
  211.     <MC>
  212.  
  213. -- 
  214. || Mark Craig Carroll: <MC>     ||"If love remains
  215. || Univ of Delaware, Dept of CIS|| Though everything is lost
  216. || Grad Student/Labstaff Hacker || We will pay the price
  217. || carroll@udel.edu             || But we will not count the cost" -Neil Peart
  218.