home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / modula2 / 1419 < prev    next >
Encoding:
Internet Message Format  |  1992-11-19  |  1.9 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!sdd.hp.com!wupost!waikato.ac.nz!comp.vuw.ac.nz!cc-server4.massey.ac.nz!TMoore@massey.ac.nz
  2. Newsgroups: comp.lang.modula2
  3. Subject: Re: Oberon vs Modula-2 (Re: mail delivery error)
  4. Message-ID: <1992Nov19.202945.17635@massey.ac.nz>
  5. From: news@massey.ac.nz (USENET News System)
  6. Date: Thu, 19 Nov 92 20:29:45 GMT
  7. References: <1992Nov13.130852.22775@jyu.fi> 
  8.  <1992Nov16.080647.26783@informatik.uni-ulm.de> <1992Nov17.155855.4413@let.rug.nl> <1992Nov19.104407.338@jyu.fi>
  9. Organization: Massey University
  10. Lines: 33
  11.  
  12. In article <1992Nov19.104407.338@jyu.fi>, sakkinen@jyu.fi (Markku Sakkinen) writes:
  13. > In article <1992Nov17.155855.4413@let.rug.nl> bert@let.rug.nl (Bert Bos) writes:
  14. > >In article <1992Nov16.080647.26783@informatik.uni-ulm.de>, borchert@titania.mathematik.uni-ulm.de (Andreas Borchert) writes:
  15. > >> Agreed, programmers shouldn't be enforced to use VAR-parameters
  16. > >> for reasons of efficiency only. But, even with the semantics of
  17.  
  18. Wait until I put on my asbestos suit...
  19.  
  20. OK
  21.  
  22. The _only_ correct way of parameter passing is for all
  23. parameters to be constant throughout the execution
  24. of the procedure, they are evaluated when the procedure
  25. is called. It is sometimes convenient to use value
  26. parameters, but it is better to declare a local variable
  27. so the parameter doesn't even _appear_ to be modified.
  28.  
  29. If you want to return values, use a function procedure.
  30. This implies that a decent laguage must return structured
  31. type. Structure displays would also be useful so that we
  32. can assign results directly to a list of variables.
  33. (E.g. (x, y) := F(u, v, w);)
  34.  
  35. For example, we might want a string APPEND procedure.
  36. Instead of the traditional
  37. APPEND(S1, S2);
  38. which changes S2 to S2 with S1 appended, you would write
  39. S2 := APPEND(S1, S2);
  40. A good compiler should be able to implement this as though
  41. var parameters were used, but implementation details are
  42. irrelevant for the high level language user.
  43.  
  44.