home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / modula2 / 1433 < prev    next >
Encoding:
Text File  |  1992-11-22  |  1.9 KB  |  51 lines

  1. Newsgroups: comp.lang.modula2
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!Sirius.dfn.de!Urmel.Informatik.RWTH-Aachen.DE!schumann!pk
  3. From: pk@rwthi3.informatik.rwth-aachen.de (Peter Klein)
  4. Subject: Re: Oberon vs Modula-2 vs Modula-3
  5. Message-ID: <1992Nov22.185530.26542@Urmel.Informatik.RWTH-Aachen.DE>
  6. Sender: news@Urmel.Informatik.RWTH-Aachen.DE (Newsfiles Owner)
  7. Nntp-Posting-Host: schumann
  8. Reply-To: pk@rwthi3.informatik.rwth-aachen.de
  9. Organization: Lehrstuhl fuer Informatik III, RWTH Aachen, Germany
  10. References: <1992Nov19.140913.18702@informatik.uni-ulm.de>
  11. Date: Sun, 22 Nov 92 18:55:30 GMT
  12. Lines: 37
  13.  
  14. In article 338@jyu.fi, sakkinen@jyu.fi (Markku Sakkinen) writes:
  15. >A good point, showing that my suggestion of constant vs. variable
  16. >is worse that value vs. variable as far as regards aliassing problems.
  17. >Thus, there would indeed be some merit in having three parameter modes
  18. >(as somebody suggested in this thread):
  19. >value, constant, and variable
  20.  
  21. This is exactly what Modula-3 has: VAL, READONLY and VAR.
  22.  
  23. In article 18702@informatik.uni-ulm.de, borchert@titania.mathematik.uni-ulm.de (Andreas Borchert) writes:
  24.  
  25. >Readonly parameters don't protect from surprises. E.g. if we have
  26. >the above mentioned
  27. >
  28. >   PROCEDURE p(a: Type; READONLY b: Type);
  29. >   BEGIN
  30. >      a[1] := ....;
  31. >      (* has b[1] been changed now? *)
  32. >   END;
  33. >
  34. >where p is called as p(x, x). And all other cases are still not solved
  35. >where formerly VAR-parameters have been threatened by other procedures
  36. >in a non-obvious way.
  37.  
  38. What is surprising about this? The semantics of the example is obvious
  39. (at least in Modula-3). b[1] is not changed, of course. a is passed by
  40. value, so the global x (and therefore b) is not changed by the assignment.
  41.  
  42. Peter
  43. ---
  44. Peter Klein                        E-Mail: pk@rwthi3.informatik.rwth-aachen.de
  45. Lehrstuhl fuer Informatik III      Tel.: +49/241/80-21320
  46. Ahornstrasse 55                    Fax.: +49/241/80-21329
  47. RWTH Aachen
  48. D-5100 Aachen
  49. Germany
  50.  
  51.