3 ms·
In an essay titled "Why Pascal is Not My Favorite Programming Language" Brian W. Kernighan wrote: <quote> The size of an array is part of its type If one decl
by mavelikara 12y ago
In an essay titled "Why Pascal is Not My Favorite Programming Language" Brian W. Kernighan wrote:
<quote>
The size of an array is part of its type
If one declares
var arr10 : array [1..10] of integer;
arr20 : array [1..20] of integer;
then arr10 and arr20 are arrays of 10 and 20 integers respectively. Suppose we want to write a procedure 'sort' to sort an integer array. Because arr10 and arr20 have different types, it is not possible to write a single procedure that will sort them both.
The place where this affects Software Tools particularly, and I think programs in general, is that it makes it difficult indeed to create a library of routines for doing common, general-purpose operations like sorting.
</quote>
Kernighan was one of the early C/Unix developers from Bell Labs. It is amusing to note that Go, whose authors come from the same background, getting criticized for something very similar.
[1]: http://www.lysator.liu.se/c/bwk-on-pascal.html http://www.lysator.liu.se/c/bwk-on-pascal.html