home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ukma!bogus.sura.net!howland.reston.ans.net!usc!news.service.uci.edu!ucivax!gateway
- From: kanderso@mabillon.ICS.UCI.EDU (Kenneth Anderson)
- Subject: Re: private types and recompilation
- Message-ID: <9301271722.aa25516@Paris.ics.uci.edu>
- Newsgroups: comp.lang.ada
- Lines: 47
- References: <7277@grus.cs.nps.navy.mil>
- Date: 28 Jan 93 01:22:24 GMT
-
- In comp.lang.ada you write:
-
- >When Ada 83 was designed, why did the designers choose to put
- >the details of private types in package specifications, rather than
- >in package bodies (which is more in the spirit of information hiding, and
- >better supports independent compilation).
-
- I'm not sure, but I think because the compiler needs to know the size
- of the types so that it can allocate space for parameters in the
- subprograms that are defined in the spec.
-
-
- >generic
- > type ATOM is private;
- >package LIST_ADT is
- > type POSITION is private;
- > type LIST is private;
- > procedure CREATE(L: in out LIST);
- > procedure INSERT_AFTER(L: in out LIST; P: POSITION; A: ATOM);
- > ...
-
- >private
- > type LIST;
- > type POSITION is access LIST;
-
- You only need the previous two lines. The declaration below can be
- hidden in the body of the package.
-
- > type LIST is record
- > A: ATOM;
- > NEXT: POSITION;
- > end record;
- >end LIST_ADT;
-
-
- >-Dave Erickson
-
- Ken
- --
- --------------------------------------------------------------------------------
- Ken Anderson | "I'd much rather live in perfection,
- U.C. Irvine | than deal with reality." -- Kenbod
- --------------------------------------------------------------------------------
- Happy! Happy! Happy! Joy! Joy! Joy! | Practice random kindness and
- -- Stimpy | senseless acts of beauty.
- | -- Anne Herbert
- --------------------------------------------------------------------------------
-