[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pascal system



John B. Matthews wrote:

> I don't understand how strong typing vitiates reuse. Ada is even more
> strongly typed than Pascal, but it enjoys excellent reuse*. Java, too. I
> would think that strong typing helps to enforce the interface-
> implementation contract and to enhance reuse. I seems to me that Pascal
> reuse is hindered more by variations in dialect than by type safety.

A good example  - a routine to sort arrays. Under Pascal, the size of
an array is a part of its type, so it's impossible to write a routine
that sorts arrays of any size, which is a bit restrictive.

Furthermore, it should be reasonable to write a routine that sorts
arrays of any type of object. Ada, Java, and C++ all provide a means to
do this. In Java, you have the Comparable interface. C++ and Ada use
their generics system or the C++ STL

Good old C has a library routine to do this, as it supports pointers to
functions and typeless pointers, which allow you to do such things in a
not typesafe way.

I appreciate that Pascal was extended over the years to alleviate these
issues, but the original definition, or UCSD which I did most of my
programming on had no such extensions, with the exception of the String
type in UCSD

Matt