home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / misc / 3732 < prev    next >
Encoding:
Text File  |  1992-11-17  |  3.2 KB  |  71 lines

  1. Newsgroups: comp.lang.misc
  2. Path: sparky!uunet!mcsun!news.funet.fi!network.jyu.fi!sakkinen
  3. From: sakkinen@jyu.fi (Markku Sakkinen)
  4. Subject: Re: Pointers
  5. Message-ID: <1992Nov17.095955.20897@jyu.fi>
  6. Organization: University of Jyvaskyla, Finland
  7. References: <1992Nov12.103513.14043@rdg.dec.com> <1992Nov12.141532.16375@jyu.fi> <1992Nov13.102813.9215@rdg.dec.com>
  8. Date: Tue, 17 Nov 1992 09:59:55 GMT
  9. Lines: 60
  10.  
  11. In article <1992Nov13.102813.9215@rdg.dec.com> jch@rdg.dec.com (John Haxby) writes:
  12. >In article <1992Nov12.141532.16375@jyu.fi>, sakkinen@jyu.fi (Markku Sakkinen) writes:
  13. >
  14. >|> [ ... ] I cannot see any semantic
  15. >|> difference between CLU variables (of non-atomic types) and reference
  16. >|> (or pointer) variables in many other languages.  'By sharing' is
  17. >|> exactly the same as 'by reference'.
  18. >
  19. >In CLU, x in
  20. >
  21. >    p1 = proc (x: int) ... end p1
  22. >and
  23. >    p2 = proc (x: string) ... end p2
  24. >
  25. >is passed by sharing.  In the VAX implementation, the p1 has its
  26. >argument passed by value, the second by reference (in the grubby
  27. >depths).  In the PCLU implementation, both procedure calls pass
  28. >a CLUREF structure (by value) which contains the value of an integer
  29. >or a pointer to string data.  `By sharing' allows the implementation of
  30. >the compiler to choose the mechanism for passing the parameter to
  31. >a procedure, the only requirement is that changing the contents of a
  32.                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^
  33. >mutable argument is reflected in all instances of the argument.
  34.  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  35. >
  36. >Don't mix implementation strategies with language semantics.
  37.  
  38. Sorry, but seems like you are discussing implementation strategies,
  39. not I.  The marked quote above says that the semantic effect is _as if_
  40. the parameter were passed by reference;  I couldn't care less how
  41. a particular compiler actually implements it.  (I have just pointed
  42. out in another thread, in comp.lang.modula2, that by-value and
  43. by-reference are equivalent for immutable parameters, so we have
  44. no argument about that.)
  45.  
  46. I would say that LISP, CLU etc. are _not_ simpler than Pascal, Ada etc.
  47. because they have no explicit pointers -- but they are simpler because
  48. they have essentially _only_ pointers.  There are no value assignments
  49. for complex objects, as a primitive language feature.
  50.  
  51. The drawback of that simplicity is that you get a lot of potential
  52. aliassing problems, which would not be necessary in those languages
  53. in which value semantics is available.  In a fashion, C and its derivatives
  54. have the worst of both worlds.  On one hand, you must explicitly take care
  55. of pointers.  On the other hand, value semantics isn't applicable to arrays.
  56. (Jim Giles has posted sufficiently about the drawbacks of C arrays,
  57. so I need not repeat any of that.)
  58.  
  59. Well, I think I have beaten this subject to death for my part.
  60. Sorry for boring the audience.
  61.  
  62. ----------------------------------------------------------------------
  63. Markku Sakkinen (sakkinen@jytko.jyu.fi)
  64.        SAKKINEN@FINJYU.bitnet (alternative network address)
  65. Department of Computer Science and Information Systems
  66. University of Jyvaskyla (a's with umlauts)
  67. PL 35
  68. SF-40351 Jyvaskyla (umlauts again)
  69. Finland
  70. ----------------------------------------------------------------------
  71.