Assignment 7, Parameter passing and activation records
Due 10/19/04 12:30 p.m.
(Must be done with your group)

  1. 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.
    1. [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.
    2. [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.
    3. Provide and discuss the evidence that supports your case. 
  2. [Skill 12.2] Repeat parts (ii) and (iii) of the question above using this link (which potentially uses a different parameter passing implementation)
  3. [Synthesis] Problem set, #3 (page 394)
  4. [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
    1. 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.
    2. Provide and discuss the evidence that supports your case.
    3. Discuss which one you prefer: deep or shallow binding.
  5. [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.
    1. Pass-by-value
    2. Pass-by-result
    3. Pass-by-value-result
    4. Pass-by-reference
    5. Pass-by-readonly-reference (i.e., same as pass-by-reference, but the argument cannot be modified, only read).
    6. Pass-by-name
  6. [Skill 12.3] Problem set #5, page 395