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-13 22:14:06 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!dispose.news.demon.net!demon!psiuk-p2!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: Wed, 13 Feb 2002 16:46:23 -0500 Organization: Posted on a server owned by Pace Micro Technology plc Message-ID: References: <721b6d80.0202131302.1ccce2ed@posting.google.com> NNTP-Posting-Host: dhcp-200-133.miami.pace.co.uk X-Trace: nh.pace.co.uk 1013636784 20896 136.170.200.133 (13 Feb 2002 21:46:24 GMT) X-Complaints-To: newsmaster@news.cam.pace.co.uk NNTP-Posting-Date: 13 Feb 2002 21:46:24 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:19993 Date: 2002-02-13T21:46:24+00:00 List-Id: Sounds like you're trying to treat a package as if it was a C++ class and you're trying to create a new instance of it because it presumably holds a set of variables you want to duplicate? First, as you discovered, you can't do that. Second, it isn't really the right idiom for Ada. The way to do it would be to have a record type declared in the package that holds all your variables. Then you create objects of the record type & use the operations contained in the package on the individual objects of that type. Something like this: package My_Package is type My_Rec is record A : Integer ; B : Integer ; C : Integer ; end record ; function Some_Operation (Rec : My_Rec) return Integer ; end My_Package ; -- Then in the unit that uses it... X : My_Package.My_Rec ; -- One instance of the A, B, C variables Y : My_Package.My_Rec ; -- A whole different instance of them. ....... -- Operates on X.A, X.B, X.C Some_Int := My_Package.Some_Operation (X) ; ....... -- Operates on Y.A, Y.B, Y.C Another_Int := My_Package.Some_Operation (Y) ; ....... If that's what you were trying to accomplish, I hope this clarifies. If it was something else, see if you can explain what you are trying to do and maybe we can help you find The Ada Way of doing it. 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/ "Yates" wrote in message news:721b6d80.0202131302.1ccce2ed@posting.google.com... > I am new to Ada. I'd like to know if it is possible to create multiple > instances of a package. For example, if I have a package 'My_Package', can > I do something like: > > p1 : My_Package := new My_Package > p2 : My_Package := new My_Package > ..... > > I tried this and didn't work. Is there other ways to do it? > > Thanks > > Yates