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