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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,faf469c89f73f91d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-02-20 14:32:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.cwix.com!newscon02.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!postmaster.news.prodigy.com!newssvr11.news.prodigy.com.POSTED!not-for-mail From: "Pat Rogers" Newsgroups: comp.lang.ada References: <721b6d80.0202131302.1ccce2ed@posting.google.com> <3C6BFAFC.7060902@mail.com> <3C73F5F6.7050704@mail.com> Subject: Re: Package Instances??? X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: NNTP-Posting-Host: 208.191.180.40 X-Complaints-To: abuse@prodigy.net X-Trace: newssvr11.news.prodigy.com 1014244281 ST000 208.191.180.40 (Wed, 20 Feb 2002 17:31:21 EST) NNTP-Posting-Date: Wed, 20 Feb 2002 17:31:21 EST Organization: Prodigy Internet http://www.prodigy.com X-UserInfo1: Q[OUS^[BTRU[RID[N[OJNW@@YJ_ZTB\MV@BNMRQIMASJETAANVW[AKWZE\]^XQWIGNE_[EBL@^_\^JOCQ^RSNVLGTFTKHTXHHP[NB\_C@\SD@EP_[KCXX__AGDDEKGFNB\ZOKLRNCY_CGG[RHT_UN@C_BSY\G__IJIX_PLSA[CCFAULEY\FL\VLGANTQQ]FN Date: Wed, 20 Feb 2002 22:31:21 GMT Xref: archiver1.google.com comp.lang.ada:20184 Date: 2002-02-20T22:31:21+00:00 List-Id: "Hyman Rosen" wrote in message news:3C73F5F6.7050704@mail.com... > Matthew Heaney wrote: > > Yes. An Ada package is analogous to a C++ namespace, not a class. > > Except that in Ada, a package can be used as a parameter for a > generic instantiation, but in C++ a namespace cannot be used as > a template argument. Given that C++ classes can have arbitrary > things defined in them (types, static functions, constants, etc.) > considering them as an analogue of Ada packages is not wrong. Yes, I agree with that sentiment, but I don't agree that one can make the analogies in isolation from other language elements. I would express it thusly: a C++ class declared is analogous to a tagged type declared within a package visible part. The package, the type, and the corresponding primitive operations work together to form an abstraction. This atomicity is illustrated, for example, by the fact that subprograms are not primitive operations of the type unless they are declared in the same package as the tagged type declaration itself (in addition to the other requirement, namely, that they mention the type in their parameter and (for functions) result type profile). Subprograms that meet the second requirement but not the first are not primitive operations of the type and thus are not inherited and are not dynamically dispatched. A package not exporting a tagged type with primitive operations could correspond to a C++ namespace. What's missing is that, like Java's packages, C++ namespaces can be extended dynamically -- they can be "re-opened". An Ada package is a module, with a definite end. But then there are subsystems... You might be interested in the Ada generated from UML by a product called "UML Studio" (www.pragsoft.com). It uses the specified namespace of the UML class, if present, as the package name, and the UML class name for the tagged type name within that package. If the namespace is not specified, it uses the class name as the package name and "Object" for the tagged type name. --- Patrick Rogers Consulting and Training in: http://www.classwide.com Real-Time/OO Languages progers@classwide.com Hard Deadline Schedulability Analysis (281)648-3165 Software Fault Tolerance