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

  1. Newsgroups: comp.lang.misc
  2. Path: sparky!uunet!cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!spool.mu.edu!news.nd.edu!mentor.cc.purdue.edu!pop.stat.purdue.edu!hrubin
  3. From: hrubin@pop.stat.purdue.edu (Herman Rubin)
  4. Subject: Re: Safety.  Was: Re: Pointers
  5. Message-ID: <BzCxs6.9oC@mentor.cc.purdue.edu>
  6. Sender: news@mentor.cc.purdue.edu (USENET News)
  7. Organization: Purdue University Statistics Department
  8. References: <724312516@sheol.UUCP> <Bz9FL2.9rp@mentor.cc.purdue.edu> <724478076@sheol.UUCP>
  9. Date: Wed, 16 Dec 1992 15:02:30 GMT
  10. Lines: 139
  11.  
  12. In article <724478076@sheol.UUCP> throopw@sheol.UUCP (Wayne Throop) writes:
  13. >:: I have not seen any posting in which Herman explains *why* he does not
  14. >:: consider unions an adequate way to specify type punning, [...]
  15.  
  16.             ......................
  17.  
  18. >: If a hardware operation, or even a "natural" operation which is somewhat
  19. >: more complicated, is not in the language, the language is excessively 
  20. >: weak if it cannot be adjoined so as to take into account hardware 
  21. >: capability.  The only language I know which has this operation explicitly
  22. >: is Galaxy. 
  23.  
  24. >"This operation" (namely, type punning) IS in C and Ada.  Herman just
  25. >objects to the "suggestion" of assignment semantics.  As I recall, PL/I
  26. >also had type punning.  And finally, aren't both Ada and PL/I's type
  27. >punning capabilities value-based rather than assignment-based? (I don't
  28. >have my manuals on those two to hand...)
  29.  
  30. What should be there for type punning is of the form
  31.  
  32.     a = use(b),
  33.  
  34. where a is an arbitrary variable and b an arbitrary expreesion,
  35. and also of the form 
  36.  
  37.     use_double(c,d)
  38.  
  39. where, for example, c and d would be 32-bit objects and double is 64-bit.
  40.  
  41. Probably simpler notation should even be found.
  42.  
  43.             ...............
  44.  
  45. >Herman is apparently seriously claiming that
  46.  
  47. >      g(0xABCD)
  48.  
  49. >is less clumsy and conveys more information than
  50.  
  51. >      g(iasf(0xABCD))
  52.  
  53. >It is essentially impossible to take Herman seriously on this point,
  54. >since it is quite obvious that the second case better conveys the
  55. >intention.  The first case that Herman claims to prefer actively
  56. >CONCEALS the intention.
  57.  
  58. >Note well, I said "the notation at the use point".  And even if I
  59. >hadn't, the definition of the iasf function better conveys intent
  60. >than actively lying to the compiler.
  61.  
  62. I have never seen iasf before.  But it would be better written as
  63. asf, but is asf "as floating" or "as fixed"; the idea is that the 
  64. ompiler does not look at how things got there, except to find them. 
  65. But I am more interested in this for variables than for constants,
  66. although it is often needed at the present time for constants.
  67.  
  68. >Again, these points are so simple and so clear that it is
  69. >remarkable indeed to have anyone capable of reading and writing
  70. >disagree with them as Herman has.   And so I remark upon it.
  71.  
  72. >: This is a chicken-and-egg phenomenon.  Most software development does
  73. >: not do certain things because the languages, compilers, and the training
  74. >: of the programmers does not mention them.  
  75.  
  76. >That doesn't answer the question.  Herman specifically requested that
  77. >students be exposed to situations where code would "really crawl" unless
  78. >heroic and often architecture-specific measures are used to optimize it. 
  79. >Such cases are extremely rare, whether or not you believe in a catch-22
  80. >deadlock between hardware features and language features, or between
  81. >developer capabilities and language features. 
  82.  
  83. If the actual code is not used, this may be difficult, but even the 
  84. initial idea that a computer manipulates objects, and that how it does
  85. this, and what objects it manipulates, are important.  But the idea of
  86. bit-twiddling, etc., seems to have been "obvious" to the early people
  87. in computing, and the use of binary in the mathematical literature
  88. before that time was extremely small.
  89.  
  90. >: What proportion of current programmers,
  91. >: even those who have had "advanced" courses, are aware of the important
  92. >: mathematical types of fixed point (NOT integer) and rational?  
  93.  
  94. >Anybody who's been exposed to Lisp and/or PL/I, to name just two
  95. >examples.  Since Herman asks about those having had "advanced" courses,
  96. >I'd say virtually 100%.  Well...  maybe as few as 90%. 
  97.  
  98. >And if you're really talking mathematics, you're probably dealing
  99. >with Mathematica or equivalent notations anyhow, not imperitive
  100. >algol-family programming languages.
  101.  
  102. I was NOT talking about these types from mathematical programming
  103. languages, but from the standpoint of mathematics.  I submit that 
  104. the number of people who know about rational and fixed-point is
  105. larger than those who know any programming language, and may very
  106. well be more than those who know about the floating-point kludge.
  107. It very definitely is a kludge mathematically.
  108.  
  109. >: Unlearning
  110. >: provides major obstacles for students in mathematics and statistics, and
  111. >: I see no good reason why CS and programming languages should be any
  112. >: different in this matter.
  113.  
  114. >Precisely my point.  CS students under Herman's regime would have
  115. >much to unlearn before they could read, write, or even think about
  116. >portable, maintainable software.  These issues may not be important
  117. >to Herman, but Herman is the exception.
  118.  
  119. They would have to unlearn nothing.  Starting out with the idea that
  120. there is a large variety of objects, and that machines operate on them
  121. in various ways, WILL cause them to question why the languages place
  122. obstacles in their use.
  123.  
  124. >: The student who takes a typical cookbook mathematics course seems to
  125. >: be farther away from eventually understanding than the one who starts
  126. >: out with the concepts and theory.
  127.  
  128. >But the concepts of and theory of mathematics do not have much to do
  129. >with the bit-bumming he recommends early exposure to, so Herman's point
  130. >is obscure in the extreme.
  131.  
  132. The bit operations are just the binary version of the "standard" decimal
  133. operations, and are by no means esoteric, except in the minds of those
  134. who would have people grow up ignorant of them.  The goto-laden code I
  135. posted was obtained from consideration of how to efficiently use "coin
  136. tosses", or other sources of random bits, to produce exponential random
  137. variables, and this topic is by no means of recent origin.  Base 2 is
  138. useful because it is useful, and not because of arcane considerations.
  139.  
  140. In the 1950s and 1960s, there was still discussion about whether computers
  141. should be binary or decimal.  The reasoning behind binary has almost 
  142. disappeared now, but it was based on computational convenience.  I could
  143. have posted the corresponding code for random digits, but it would have
  144. been far more complicated and less efficient; tests are still mostly done
  145. as 0-1.
  146. -- 
  147. Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907-1399
  148. Phone: (317)494-6054
  149. hrubin@snap.stat.purdue.edu (Internet, bitnet)  
  150. {purdue,pur-ee}!snap.stat!hrubin(UUCP)
  151.