home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / object / 4645 < prev    next >
Encoding:
Text File  |  1992-12-22  |  2.9 KB  |  66 lines

  1. Newsgroups: comp.object
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!spool.mu.edu!yale.edu!ira.uka.de!chx400!bernina!neptune!santas
  3. From: santas@inf.ethz.ch (Philip)
  4. Subject: Re: Object hidden state and side effects
  5. Message-ID: <1992Dec23.013714.1769@neptune.inf.ethz.ch>
  6. Sender: news@neptune.inf.ethz.ch (Mr News)
  7. Nntp-Posting-Host: ru8.inf.ethz.ch
  8. Organization: Dept. Informatik, Swiss Federal Institute of Technology (ETH), Zurich, CH
  9. References: <knight.724800099@cunews> <BzMnKp.B4J@inews.Intel.COM> <BzMpwB.7y3@newsflash.concordia.ca>
  10. Date: Wed, 23 Dec 1992 01:37:14 GMT
  11. Lines: 53
  12.  
  13.  
  14. In article <BzMpwB.7y3@newsflash.concordia.ca> grogono@cs.concordia.ca (Peter Grogono) writes:
  15. >bongalon@tcad05.intel.com (Ben Bongalon) writes:
  16. >>
  17. >>why would you want to consider "i" and "(i^5)" as equal but not
  18. >>identical values? Do you consider "1" and "(3-2)" equal but not
  19. >>identical also?  From a pragmatic point of view, the distinction
  20. >>between the simplified and unsimplified forms of the expressions
  21. >>seem questionable.
  22. >
  23. >It depends what you mean by "pragmatic". It is true that, when we are
  24. >thinking informally, there is not much difference between "1" and
  25. >"3-2". But there is a vast difference computationally. 
  26.  
  27. Quite agree. To reinforce this argument, the distinction is not only in 
  28. terms of computational effort, but also in terms of consistency of operations.
  29. Simplifications performed globaly, without any type information,
  30. can lead to unexpected results:
  31. consider the case:
  32.    random() - random()
  33. or to think of the example above:
  34.   (random()+1) - random()
  35.    
  36. >Many
  37. >languages, including Prolog, are formally defined as term languages.
  38. >In a term language, "1" and "3-2" are different terms and are thererfore
  39. >unequal. A Prolog interpreter needs a simplifier, which would not be
  40. >part of a "formal" implementation, to turn one into the other.
  41. >The consequence is that arithmetic predicates behave differently
  42. >from other predicates, although implementations try to hide this as
  43. >much as they can.
  44.  
  45. Unfortunately. One of the main reasons here is that term rewritting, and
  46. pattern based systems use _global_ optimization techniques, and exclude 
  47. type information from their algorithms (implmentation of numbers is the 
  48. exception). This leads again to strange results, since one might expect 
  49. that, from the overall behaviour of the system, 3-2 is different from 1.
  50.  
  51. Use of pure functions without predefined pattern matching, is the only 
  52. available solution to this problem, as functional languages demonstrate.
  53.  
  54. Philip Santas
  55.  
  56.   "In an evolving universe those who stand still are really moving backwards"
  57. --------------------------------------------------------------------------------
  58. email: santas@inf.ethz.ch                 Philip Santas
  59. Mail: Dept. Informatik                   Inst. of Scientific Computation
  60.       ETH-Zentrum              Swiss Federal Institute of Technology
  61.       CH-8092 Zurich                       Zurich, Switzerland
  62.       Switzerland
  63. Phone: +41-1-2547478
  64.       
  65.  
  66.