From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a8985ede8fe3d111 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-10-23 12:14:45 PST Newsgroups: comp.lang.ada Path: bga.com!news.sprintlink.net!howland.reston.ans.net!noc.near.net!inmet!dsd!bobduff From: bobduff@dsd.camb.inmet.com (Bob Duff) Subject: Re: Child packages Message-ID: Sender: news@inmet.camb.inmet.com Organization: Intermetrics, Inc. References: <1994Oct4.090807@di.epfl.ch> <383h86$12ip@watnews1.watson.ibm.com> <38496c$1l1@gnat.cs.nyu.edu> <385thq$kh6@watnews1.watson.ibm.com> Date: Thu, 20 Oct 1994 16:37:12 GMT Date: 1994-10-20T16:37:12+00:00 List-Id: In article <385thq$kh6@watnews1.watson.ibm.com>, Norman H. Cohen wrote: >While child packages provide many more advantages than disadvantages, I >feel we have lost something important from Ada 83--a clearly marked, >compiler-recognized distinction between those aspects of a module that do >and do not form a part of its "contract". This is an interesting point. Note, however, that the contents of a package body, and the contents of a *private* child package, are hidden from clients and from new (public) children. By the way, this whole discussion has been about what happens when somebody extends an existing system by adding children. Don't forget that a hierarchy of children is a good way to organize a subsystem being written by one person or team -- we don't need to imagine a separate organization extending the subsystem in order to find a use for child units. A lot of cases that in Ada 83 would be done as a single package will tend to be split into a hierarchy in Ada 9X. Note also that the distinction between public and private has never been perfect in Ada. If you see (in the visible part of a package): Message: constant String := "File not found."; You can't be sure exactly what information is being exported. Is the package promising that this string will always be 15 characters long, and/or contain exactly those characters? Or is it merely promising that the thing is called Message, and it's of type String. If somebody wants to change the message to be more informative, will that break existing clients? We don't know for sure. Now, you may say that one ought to have made it a function, so changing the message would only require a change to the body. Well, perhaps, but that interface promises less to the client in one respect -- the client can be sure that a reference to Message above will not have side effects, and will always produce the same value. Using a function doesn't make any such promise. Furthermore, it's more verbose (by a factor of 5, if you're counting lines of code), so a lot of people will choose the constant-declaration way. -- Bob Duff bobduff@inmet.com Oak Tree Software, Inc. Ada 9X Mapping/Revision Team (Intermetrics, Inc.)