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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,3abdaa39e1c27f49 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!not-for-mail From: naasking@gmail.com (Sandro Magi) Newsgroups: comp.lang.ada Subject: Re: Discriminant computation problem Date: 15 Nov 2004 06:02:39 -0800 Organization: http://groups.google.com Message-ID: <7e2ad2d.0411150602.79ee1251@posting.google.com> References: NNTP-Posting-Host: 64.229.98.192 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1100527360 4494 127.0.0.1 (15 Nov 2004 14:02:40 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 15 Nov 2004 14:02:40 +0000 (UTC) Xref: g2news1.google.com comp.lang.ada:6206 Date: 2004-11-15T06:02:39-08:00 List-Id: Jim Rogers wrote in message news:... > You might want to reconsider your design. > First of all, your chosen example is a very poor way to represent > a bit vector in Ada. This appears to be an Ada translation of a C > or C++ programming approach. As I said, it was just the simplest example of what I was trying to do. It's not what I'm actually trying to do. > My second point deals with your desire to perform a calculation > on a parameterized value. The more acceptable way to accomplish > such an end is the use of a generic package rather than a > record discriminant. The use of a generic package provides > encapsulation and information hiding for your operations that > prevent you from unnecessarily exposing internal data structures. I was trying to avoid the extra step of instantiating a generic package. Furthermore, the types from one package would not be interoperable with the types from another package would they? ie. using my Bit_Vector example and assuming the package defines an Append operation: procedure Test is package Bit_Vector_1024 is new Bit_Vector(1024); package Bit_Vector_2048 is new Bit_Vector(2048); b1024 : Bit_Vector_1024.Bit_Vector; b2048 : Bit_Vector_2048.Bit_Vector; begin ... (initialize some data in each vector) ... --this would fail to type check wouldn't it? Append(Data=>b1024, To=>b2048); end Test; Sorry for asking something so obvious, but I can't check this myself at the moment.