home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / modula3 / 883 < prev    next >
Encoding:
Text File  |  1992-08-25  |  1.6 KB  |  40 lines

  1. Newsgroups: comp.lang.modula3
  2. Path: sparky!uunet!mcsun!sun4nl!freya.let.rug.nl!rug4!laverman
  3. From: laverman@cs.rug.nl (Bert Laverman)
  4. Subject: READONLY parameters; what are they really?
  5. Message-ID: <1992Aug26.113756.8590@cs.rug.nl>
  6. Originator: laverman@rug16
  7. Sender: usenet@cs.rug.nl
  8. Nntp-Posting-Host: rug16
  9. Organization: Dept. of Computing Science, Groningen University
  10. Date: Wed, 26 Aug 1992 11:37:56 GMT
  11. Lines: 27
  12.  
  13.  
  14. Dear all,
  15.   In SPwM3 (page 28) it says: "... A READONLY formal is treated as a VAR
  16. formal if the actual is a designator and the type of the actual is the same
  17. as the type of the format (...); otherwise it is treated as a VALUE formal."
  18.  
  19. IMHO I have to conclude from this that:
  20.   -  either READONLY parameters can come in two forms, with a check needed at
  21.      runtime in the procedure for each invocation, or
  22.   -  VALUE actuals are assigned to anonymous new variables, which in turn are
  23.      passed as conventional VAR parameters.
  24.  
  25. The first option seems most likely, the second reeks of FORTRANisms. For `large'
  26. types (the ones for which values are not pushed directly on the stack when passed
  27. as VALUE parameter) the first option is simple enough for both caller and callee,
  28. but for small types (eg, INTEGER), as callee I'ld have to check to see how the
  29. actual has been given.
  30.  
  31. Of course it could be that READONLY is specifically for passing larger values
  32. efficiently when we know they wont be modified...
  33.  
  34. Greetings, Bert
  35. -- 
  36. #include <std/disclaimer>
  37.  
  38.   Bert Laverman,  Dept. of Computing Science, Groningen University
  39.   Friendly mail to: laverman@cs.rug.nl      The rest to: /dev/null
  40.