Chapter 6

Most of the information on this and other chapters refers directly to material in Wilson, L.B. and Clark, R.G., Comparative Programming Languages (Third Edition, updated by R.G. Clark), Addison-Wesley, September 2000, ISBN 0-201-71012-9.

The material is intended to supplement the textbook by providing further examples and discussion. It is not self-standing, but assumes that you have a copy of the book to hand.

Section 6.2 Parameters

Supplementary Questions

  1. Describe the difference between call by value and call by constant-value. What is the drawback of call by value or call by constant-value when structured variables are being passed?
  2. Call by reference and call by value-result are used for the same purpose. Describe how they differ and the circumstances in which one may be preferred to the other.

Section 6.3 Functions

Supplementary Questions

  1. What is a side-effect? Why should procedures and functions be self-contained? What is a pure function and why is it especially important that functions are self-contained?
  2. Why are value returning methods not usually self-contained? Is this a problem? What is the equivalent of a pure function in an object-oriented language?