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.3 required=5.0 tests=BAYES_00,INVALID_MSGID,XPRIO autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6b6619eb9cada212 X-Google-Attributes: gid103376,public From: "Robert C. Leif, Ph.D." Subject: RE: Help me to chose between ADA 95 and C++ Date: 1999/12/15 Message-ID: #1/1 X-Deja-AN: 561262745 Content-Transfer-Encoding: 7bit To: X-Priority: 3 (Normal) Content-Type: text/plain; charset="iso-8859-1" X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 X-Complaints-To: usenet@enst.fr Importance: Normal X-Trace: menuisier.enst.fr 945316179 7671 137.194.161.2 (16 Dec 1999 03:49:39 GMT) Organization: ENST, France X-BeenThere: comp.lang.ada@ada.eu.org X-MSMail-Priority: Normal Mime-Version: 1.0 Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Date: 16 Dec 1999 03:49:39 GMT Newsgroups: comp.lang.ada Date: 1999-12-16T03:49:39+00:00 List-Id: Richard I was remarking on a standard private type in the specification of a generic or any other package. If your numeric types are declared in the private part of a package, you can not set them equal to the literal value of a number, like 7. Perhaps your solution of using generics would eliminate this problem. I can not write a subprogram specification to put into a package specification using ":=" as a function where the formal parameter would be a universal type. This makes be question how you could create an instantiation of a generic function to do this. Yours, Bob -----Original Message----- From: Richard D Riehle [mailto:laoXhai@ix.netcom.com] Sent: Tuesday, December 14, 1999 7:09 PM To: comp.lang.ada@ada.eu.org Subject: RE: Help me to chose between ADA 95 and C++ In article , "Robert C. Leif, Ph.D." wrote: >From: Bob Leif >To: Richard Riehle et al. >How do you set an instantiation equal to a universal integer or >universal_real? I tried to do this with a 32 bit data type and had to define >a non_private type for simple operations like >Data_32 : Data_32_Type := 7; >I then converted from the non_private to the private (Ugly). Robert, A universal integer is not a defined type. You would want to declare a type to accomplish instantiation using my generic example. It cannot be instantiated with a universal integer or a universal float since it is a private type formal parameter. I am not sure whether I actually answered your question. Perhaps someone else will have a different reading of it. Regards, Richard -- =========== Code from my earlier post follows ================= >generic > type Number is private; > with function "+" (L, R : Number) return Number is <>; > -- all other operators similarly declared as generic parameters >package Generic_Operators is end Generic_Operators; > >with Generic_Operators; >generic > with package Operators is new Generic_Operators (<>); >package Statistics is > ... >end Statistics; > >which allows instantiation with any numeric type. Also, there is a >way to instantiate this with a non-numeric type that I published in >an Ada Letters a couple of years ago. > >So, on this point, Chris, I am pretty much in agreement with you. > >Richard Riehle > > P.S. I apologize if my earlier reply was a bit to harsh. > > > > > >