CIS
LECTURE 21
 
Chapter
11 in Sebasta, »page 435
 
Object
oriented languages
 
polymorphism
º object free to respond to a message in
appropriate fashion
 

 
 
By
pointing to a base class you can point to anything derived from that base class
(explicit
vs. implicit type casting)
uses
dynamic type binding, (very difficult to type check)
 
Virtual
methods:
Not
known at run time
 

 
 
 
 
 
 
 
Chapter
9, sub-programs
 
Programming
language implementation
3
ways to use computer memory:
1)     
Static
languages, (Fortran/ Cobol), all memory usage known at translation
2)     
Stack
based languages, (Algol 60/ Pascal), recursion allowed, activation records can
be created indefinitely
3)     
Dynamic,
(Lisp/ APL/ Prolog), heap based memory usage
 
Unit-procedure/function
procedure®code segment + data segment, (both local and
non-local variables)
 
Non-local
references:
1)     
Explicit
common, (shared data area)
2)     
Import/export
3)     
Static
scope, (lexical position)
4)     
Dynamic
scope, (last association)
 
Fortran
structure, (static):
 

 
History
sensitivity is possible in Fortran
 
Algol-like
structure:

 
 
 
 

 
 
 

 
 
 
 
 Activation stack:

 
 
 
 
 
3
types of variables
1)     
Static
variable
2)     
Semi-dynamic
variable
3)     
Fully
dynamic variable, (amount of storage may change during execution), store a base
address to heap, i.e.:
 
[1:n] int a