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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,67fd28f4008484be,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!feeder.news-service.com!feeder.news-service.com!94.75.214.39.MISMATCH!aioe.org!.POSTED!not-for-mail From: "Nasser M. Abbasi" Newsgroups: comp.lang.ada Subject: unconstrained subtype in component declaration, tagged OO Date: Sat, 26 Mar 2011 13:24:37 -0700 Organization: Aioe.org NNTP Server Message-ID: Reply-To: nma@12000.org NNTP-Posting-Host: tUYQ4Ty9mMw9Pdc8TJRFQA.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 X-Notice: Filtered by postfilter v. 0.8.2 Xref: g2news2.google.com comp.lang.ada:19449 Date: 2011-03-26T13:24:37-07:00 List-Id: I am learning a bit about Ada OO, and I have simple problem, hopefully with simple answer, but not able to find one so far. I want to make an object, but the declaration of the tagged record would include an array in it. The size of this array, at the time of declaration is not know. But will be when the object is created. So, what is the correct way to declare such an object? Here is my ads package for the object: -------------------foo.ads------- package foo is type foo_t is tagged private; -- primitive operations function make(n:natural) return foo_t; private type u_t is array(natural range<>) of float; type foo_t is tagged record u : u_t:= (others=>0.0); -- problem here end record; end foo; ---------------------------- Later on, (when I can get this to compile :), I wanted to write with foo; use foo; ... o : foo_t := make(100); I can solve this problem by making a generic package, and use the size as the generic of the package, but I really do not want to do that. I want to keep things very simple for now, as I am just learning this, and wanted the most simple solution. As I am now learning Ada again, I am sure I will be back here with more questions to the experts. thanks --Nasser