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.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no 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-21 16:33:38 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!psinet-eu-nl!psiuk-p4!uknet!psiuk-p3!uknet!psiuk-n!news.pace.co.uk!nh.pace.co.uk!not-for-mail From: "Marin David Condic" Newsgroups: comp.lang.ada Subject: Re: Package Instances??? Date: Thu, 21 Feb 2002 09:05:47 -0500 Organization: Posted on a server owned by Pace Micro Technology plc Message-ID: References: <721b6d80.0202131302.1ccce2ed@posting.google.com> <3C6BFAFC.7060902@mail.com> <3C73F5F6.7050704@mail.com> <3C7487D6.5060603@mail.com> NNTP-Posting-Host: dhcp-200-133.miami.pace.co.uk X-Trace: nh.pace.co.uk 1014300349 27184 136.170.200.133 (21 Feb 2002 14:05:49 GMT) X-Complaints-To: newsmaster@news.cam.pace.co.uk NNTP-Posting-Date: 21 Feb 2002 14:05:49 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: archiver1.google.com comp.lang.ada:20239 Date: 2002-02-21T14:05:49+00:00 List-Id: But why fight it? When programming in C++, the fundamental idiom is the class - maybe with a namespace around it to isolate the identifiers & produce better encapsulation. When programming in Ada, the fundamental idiom is the package - which gives you encapsulation and lots of other cool stuff - but isn't an "object" or a "type" so it can't really do what a C++ class does. It needs to contain a tagged type to complete the picture. I don't think that C++ really has an analog for what Ada does with a package - at least nothing that provides anything resembling a mirror image. It has things that will give you some of the features of a package - but because it carries so much legacy from C the whole concept of what Ada does with a package is rather foreign and it would be difficult to add something to C++ that would create a "package" and still maintaining upward compatibility. I think Ada's packages are a big advantage and a good reason to do things in Ada instead of C++ (or C, for that matter). The encapsulation, separation of interface and implementation and information hiding alone is worth it. You can get something similar out of C++, sort of, if you work at it, but it always seemed to me to be something you had to cobble together out of spare parts in a junk drawer rather than something that was inherently engineered into the language. MDC -- Marin David Condic Senior Software Engineer Pace Micro Technology Americas www.pacemicro.com Enabling the digital revolution e-Mail: marin.condic@pacemicro.com Web: http://www.mcondic.com/ "Hyman Rosen" wrote in message news:3C7487D6.5060603@mail.com... > > But my purpose isn't to implement a type, it's to find a C++ analogue > for Ada packages. C++ namespaces are useless for anything except what > the name implies, namely establishing a namespace. >