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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,aea4cc77526f5e4a X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!out03a.usenetserver.com!news.usenetserver.com!in01.usenetserver.com!news.usenetserver.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshub.sdsu.edu!newscon04.news.prodigy.net!prodigy.net!newsdst01.news.prodigy.net!prodigy.com!postmaster.news.prodigy.com!nlpi069.nbdc.sbc.com.POSTED!4988f22a!not-for-mail From: Newsgroups: comp.lang.ada References: <7xJvj.7420$Ru4.4246@newssvr19.news.prodigy.net> Subject: Re: Separate Compilation in Programming Languages X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 Message-ID: NNTP-Posting-Host: 70.134.114.51 X-Complaints-To: abuse@prodigy.net X-Trace: nlpi069.nbdc.sbc.com 1203838280 ST000 70.134.114.51 (Sun, 24 Feb 2008 02:31:20 EST) NNTP-Posting-Date: Sun, 24 Feb 2008 02:31:20 EST Organization: AT&T http://yahoo.sbc.com X-UserInfo1: O@Y[R^[GZRRER_H]]RKB_UDAZZ\DPCPDLXUNNHPHBATBTSUBYFWEAE[YJLYPIWKHTFCMZKVMB^[Z^DOBRVVMOSPFHNSYXVDIE@X\BUC@GTSX@DL^GKFFHQCCE\G[JJBMYDYIJCZM@AY]GNGPJD]YNNW\GSX^GSCKHA[]@CCB\[@LATPD\L@J\\PF]VR[QPJN Date: Sat, 23 Feb 2008 23:31:58 -0800 Xref: g2news1.google.com comp.lang.ada:20037 Date: 2008-02-23T23:31:58-08:00 List-Id: "Robert A Duff" wrote in message news:wccbq679zah.fsf@shell01.TheWorld.com... In the example you provided (shown below) you did defer the with clause for the Package P1 to the package body of P2. This illustrates my point. If the specification for P1 changes, only the body for P2 needs to be compiled. Had the with clause been at the specification level for P2, and had the specification for P1 changed, the entire package would have had to be compiled. I think the same is true for Java. If the specification for the Interface is changed, everything needs to be recompiled. In Ada, by deferring the with clause to the package body, we only need to re-compile the body. So, I think your example actually supports my original assertion. The essential point is that changes in the specifications for a package (or a Java class) should not require re-compilation of the dependent specifications. Only the implementations should be dependent on other specifications. This has the effect of keeping the high-level architecture more stable. package P1 is type Iface is interface; ... declare some abstract procedures ... end P1; package P2 is pragma Elaborate_Body; -- Note that this package spec can be entirely empty (except we -- need the pragma so we are allowed to have a body). -- So this package spec isn't defining any interface to -- anything at all! end P2; with P1; package body P2 is type Impl is new P1.Iface with ... ... override procedures ... ... end P2; -- No body for P1! Then the client can "with P1", and call operations on Iface objects without knowing anything about package P2 (neither spec nor body). There is no dependence of clients on P2 (unless I'm misunderstanding what you mean by "depend").