Assignment 7, Parameter passing and activation records
Due 10/19/04 12:30 p.m.
(Must be done with your group)
- In this question you will discover the parameter passing mechanism for
MYSTERY using
this web page to
access the PL-Detective. For the purpose of this question assume that the
actual's type and the corresponding formal's type must be the same, using
structural type equality. Also assume that
mystery uses static scoping.
- [Skill 12.1] For each parameter passing implementation described
in Section 9.5.2 of text give a realistic example for which the
implementation is most suitable. Support your answer with clear
arguments.
- [Skill 12.2] Determine and describe the parameter passing mechanism in
mystery using the above link.
Be sure to state how MYSTERY's
implementation addresses the issues discussed in part (i). Your submissions
may execute up to 10 PRINTs. Each additional PRINT will be charged 5% of
the points for the question.
- Provide and discuss the evidence that supports your case.
- [Skill 12.2] Repeat parts (ii) and (iii) of the question above using
this link (which
potentially uses a different parameter passing implementation)
- [Synthesis] Problem set, #3 (page 394)
- [Skill 13.2] In this question you will use
this link to
determine if MYSTERY uses deep
or shallow binding for procedures that are passed as parameters. For the
purpose of this question assume that the actual's type and the corresponding
formal's type must be the same, using structural type equality
- Determine and describe whether
mystery uses deep or shallow binding for passed procedures. Your
submission may execute up to 4 PRINTs. Each additional PRINT will be
charged 5% of the points for the question.
- Provide and discuss the evidence that supports your case.
- Discuss which one you prefer: deep or shallow binding.
- [Skill 13.1] Assume that you have a procedure with a single formal
parameter of type T. Now, let's suppose you want to call it with an
actual parameter of type U. How should types T and U be related in
order for the call to be safe with respect to types given each of the
following parameter passing implementations. Clearly explain your
answer.
- Pass-by-value
- Pass-by-result
- Pass-by-value-result
- Pass-by-reference
- Pass-by-readonly-reference (i.e., same as pass-by-reference, but the
argument cannot be modified, only read).
- Pass-by-name
- [Skill 12.3] Problem set #5, page 395