Path: utzoo!utgpu!watmath!att!tut.cis.ohio-state.edu!pt.cs.cmu.edu!sei!prp
From: prp@sei.cmu.edu (Patrick Place)
Newsgroups: comp.lang.misc
Subject: Re: Which language to teach first?
Message-ID: <3781@fy.sei.cmu.edu>
Date: 8 Aug 89 17:43:38 GMT
References: <2565@aplcen.apl.jhu.edu>
Organization: Carnegie-Mellon University (Software Engineering Institute), Pgh, PA
Lines: 32

In article <2565@aplcen.apl.jhu.edu>, genesch@aplvax.jhuapl.edu (Eugene Schwartzman) writes:
> In article <6204@hubcap.clemson.edu> billwolf%hazel.cs.clemson.edu@hubcap.clemson.edu (William Thomas Wolfe,2847,) writes:
> =   How do you enforce the security of an ADT without limited private types?
> 	Very easily, put procedures inside procedures, etc.. etc...  The
> 	data types in the inside procedures can't be accessed outside of it.
Without entering into any language wars here, it seems that procedures
inside procedures is not sufficient for enforcing the security of
an ADT.  Consider the scenario where I am providing some interface I
to an ADT.  The only visibility I want users to have is that interface, I.
My ADT may well have other routines which are to be shared by the interface
routines.  If I put these inside one of the procedures in I, well then
it can't be shared (unless it is duplicated - not a great idea). So,
these shared routines must be accessible at a higher level, the only
level of which is the entire program.  The same goes for data, and it
can almost be guaranteed that there will be shared data between the
interface routines I of the ADT.

So what is the solution?
In Pascal, you have to construct one procedure that contains all
the real interface routines and shared data, as well as any supporting
routines, and the body of this procedure must then separate out the
parameters and invoke the correct ADT interface routine.  The difficulty
here lies in the possibly large number of parameters in the ADT
surrounding procedure, the unused parameters in all of the calls to
this one ADT surrounding procedure and the disentangling of the single
interface into the appropriate real interface.

Which all goes to show that Pascal was not designed with ADT's in mind.
Languages such as Ada, Modula 2, Euclid ... have the necessary level
of abstraction for supporting ADTs though it may not be sufficient.

Pat Place prp@sei.cmu.edu