[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: pascal system
In article <1149657175.598486.299580@c74g2000cwc.googlegroups.com>,
"mdj" <mdj.mdj@gmail.com> wrote:
> 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.
I see; this may be two sides of the same coin. The lack of genericity in
Pascal prompted a variety of (incompatible) schemes including UNIV type
parameters and type-risky pointer schemes.
> 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
Indeed! On a whim I ported some UCSD code to Kyan and FPC (a TP
descendant). I was amazed both that it was so hard and that it worked at
all:-)
> Matt
--
John Matthews
jmatthews at wright dot edu
www dot wright dot edu/~john.matthews/