Object Composition - Timeline of Composition in Various Languages

Timeline of Composition in Various Languages

C calls a record a struct or structure; object-oriented languages such as Java, Smalltalk, and C++ often keep their records hidden inside objects (class instances); languages in the ML family simply call them records. COBOL was the first programming language to support records directly; ALGOL 68 got it from COBOL and Pascal got it, more or less indirectly, from ALGOL 68. Common Lisp provides structures and classes (the latter via the Common Lisp Object System).

1959 – COBOL
01 customer-record. 03 customer-number pic 9(8) comp. 03 customer-name. 05 given-names pic x(15). 05 initial-2 pic x. 05 surname pic x(15). 03 customer-address. 05 street. 07 house-number pic 999 comp. 07 street-name pic x(15). 05 city pic x(10). 05 country-code pic x(3). 05 postcode pic x(8). 03 amount-owing pic 9(8) comp.
1960 – ALGOL 60

Arrays were the only composite data type in Algol 60.

1964 – PL/I
dcl 1 newtypet based (P); 2 (a, b, c) fixed bin(31), 2 (i, j, k) float, 2 r ptr; allocate newtypet;
1968 – ALGOL 68
int max = 99; mode newtypet = struct ( long real a, b, c, short int i, j, k, ref real r ); newtypet newarrayt = (1, 2, 3, 4, 5, 6, heap real := 7)

For an example of all this, here is the traditional linked list declaration:

mode node = union (real, int, compl, string), list = struct (node val, ref list next);

Note that for ALGOL 68 only the newtypet name appears to the left of the equality, and most notably the construction is made – and can be read – from left to right without regard to priorities.

1970 – Pascal
type a = array of integer; b = record a, b, c: real; i, j, k: integer; end;
1972 – K&R C
# define max 99 struct newtypet { double a, b, c; float r; short i, j, k; } newarrayt ;
1977 – FORTRAN 77

Fortran 77 has arrays, but lacked any formal record/structure definitions. Typically compound structures were built up using EQUIVALENCE or COMMON statements:

CHARACTER NAME*32, ADDR*32, PHONE*16 REAL OWING COMMON /CUST/NAME, ADDR, PHONE, OWING
1983 – ADA
type Cust is record Name : Name_Type; Addr : Addr_Type; Phone : Phone_Type; Owing : Integer range 1..999999; end record;
1983 – C++
const int max = 99; class{ public: double a, b, c; float &r; short i, j, k; }newtypet ;
1991 – Python
max = 99 class NewTypeT: def __init__(self): self.a = self.b = self.c = 0 self.i = self.j = self.k = 0.0 # Initialise an example array of this class. newarrayt = for j in range(10)]
1992 – FORTRAN 90

Arrays and strings were inherited from FORTRAN 77, and a new reserved word was introduced: type

type newtypet double precision a, b, c integer*2 i, j, k * No pointer type REF REAL R end type type (newtypet) t(10, 100)

FORTRAN 90 updated and included FORTRAN IV's concept called NAMELIST.

INTEGER :: jan = 1, feb = 2, mar = 3, apr = 4 NAMELIST / week / jan, feb, mar, apr
1994 – ANSI Common Lisp

Common Lisp provides structures and the ANSI Common Lisp standard added CLOS classes.

(defclass some-class ((f :type float) (i :type integer) (a :type (array integer (10)))))

For more details about composition in C/C++, see Composite type.

Read more about this topic:  Object Composition

Famous quotes containing the words composition and/or languages:

    The naive notion that a mother naturally acquires the complex skills of childrearing simply because she has given birth now seems as absurd to me as enrolling in a nine-month class in composition and imagining that at the end of the course you are now prepared to begin writing War and Peace.
    Mary Kay Blakely (20th century)

    People in places many of us never heard of, whose names we can’t pronounce or even spell, are speaking up for themselves. They speak in languages we once classified as “exotic” but whose mastery is now essential for our diplomats and businessmen. But what they say is very much the same the world over. They want a decent standard of living. They want human dignity and a voice in their own futures. They want their children to grow up strong and healthy and free.
    Hubert H. Humphrey (1911–1978)