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

  1. Newsgroups: comp.lang.modula2
  2. Path: sparky!uunet!spool.mu.edu!uwm.edu!caen!destroyer!cs.ubc.ca!uw-beaver!news.tek.com!psgrain!m2xenix!mikeg
  3. From: mikeg@psg.com (Mike Gallo)
  4. Subject: Re: Oberon vs Modula-2 (Re: mail delivery error)
  5. Organization: Pacific Systems Group, Portland Oregon US
  6. Date: Fri, 20 Nov 1992 01:40:05 GMT
  7. Message-ID: <1992Nov20.014005.21934@psg.com>
  8. References: <1992Nov16.080647.26783@informatik.uni-ulm.de> <1992Nov17.155855.4413@let.rug.nl> <1992Nov19.104407.338@jyu.fi>
  9. Lines: 26
  10.  
  11. In article <1992Nov19.104407.338@jyu.fi> sakkinen@jyu.fi (Markku Sakkinen) writes:
  12. >In article <1992Nov17.155855.4413@let.rug.nl> bert@let.rug.nl (Bert Bos) writes:
  13. >>In article <1992Nov16.080647.26783@informatik.uni-ulm.de>, borchert@titania.mathematik.uni-ulm.de (Andreas Borchert) writes:
  14. >>> Agreed, programmers shouldn't be enforced to use VAR-parameters
  15. >>> for reasons of efficiency only. But, even with the semantics of
  16. >>> Oberon or Modula-2, it's not to difficult for the compiler to
  17. >>> detect that your 1000 x 1000 array isn't modified and, thus,
  18. >>> doesn't need to be copied.
  19. >>> ...
  20. >>But what about a PROCEDURE p(a: Type; VAR b: Type) that is called as p(x, x). Both parameters will refer to x, but if b is modified, a should remain unchanged.
  21. >
  22. >A good point, showing that my suggestion of constant vs. variable
  23. >is worse that value vs. variable as far as regards aliassing problems.
  24. >Thus, there would indeed be some merit in having three parameter modes
  25. >(as somebody suggested in this thread):
  26. >value, constant, and variable (and possibly yet something like 'out'
  27. >in Ada, i.e. a result parameter).
  28.  
  29. The Turing language offers two paramter modes, variable and
  30. "constant".  Their solution to the above problem is that actual
  31. variable parameters must be unique, although the above sort of problem
  32. was not the explicit reason for doing so.  Their justification was
  33. that the logic of the procedure assumes that different variable
  34. parameters are different variables, and so the compiler shoulf enforce
  35. it.  
  36.  
  37.