Pass by Name

Implementation Method:

Actual Parameter Equivalent Implementation
Scalar Variable Pass by Reference
Constant Expression Pass by Value
Array Element Late Binding
Expression with Variables Late Binding
Delayed Binding:
int global;

void main()
{
  int array[5] = {0};
  global = 2;
  nameProc( array[global] );  
}

void nameProc( int formal )
{
  formal = 5;
  global++;
  formal = 10;  
}
Jensen's Device:

void main()
{
  const int size = 5;
  int local = 2;
  int array[size];
  int list[size];
  int index;

  for( index = 0; index < size; index++ )
  {
    array[index] = index;
    list[index] = index;
  }

  index = 0;
  print jensensDevice( local, index, size );
  print jensensDevice( array[index], index, size );
  print jensensDevice( array[index] * list[index], index, size );

}

int jensensDevice( int term, int index, int length )
{
  int sum = 0;
  for( index = 0; index < length; index++ )
    sum += term;
  
  return sum;
}

Disadvantages:

Traditional Implementation in Algol-60 Descendants:

thunk is used: