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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,2bbd7f65ab12f156,start X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Date: Mon, 13 Aug 2007 23:16:05 +0200 From: Gautier User-Agent: Thunderbird 1.5.0.12 (Windows/20070509) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Q: how to copy contents and use ancestor's constraints at the same time ? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 83.76.175.94 X-Original-NNTP-Posting-Host: 83.76.175.94 Message-ID: <46c0c9e8$1_3@news.bluewin.ch> X-Trace: news.bluewin.ch 1187039720 83.76.175.94 (13 Aug 2007 23:15:20 +0200) Organization: Bluewin AG Complaints-To: abuse@bluewin.ch X-Original-NNTP-Posting-Host: 127.0.0.1 Path: g2news2.google.com!news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns13feed!worldnet.att.net!164.128.36.58!news.ip-plus.net!newsfeed.ip-plus.net!news.bluewin.ch!not-for-mail Xref: g2news2.google.com comp.lang.ada:1428 Date: 2007-08-13T23:16:05+02:00 List-Id: Hello! In the procedure below, how to do [A] and [B] together, and is there a way not to have to write the constraints, like when constraining an object by initializing it with a value of the same type ? Thanks in advance! NB: I looked in a book, but maybe not hard enough ;-) ----- procedure Test_Ancestor_copy is type Index_array_type is array(Positive range <>) of Natural; type PF_Data( n1: Natural; n2: Natural; n3: Natural ) is tagged record p1 : Index_array_type(1..n1); p2 : Index_array_type(1..n2); p3 : Index_array_type(1..n3); end record; function Read return PF_Data is begin return (n1 => 1, n2 => 2, n3 => 3, p1 => (1=>1), p2 => (1,2), p3 => (1,2,3) ); end Read; type PF is new PF_Data with record computed: Boolean:= False; result: Float; end record; initial_pf: constant PF_Data:= Read; work_pf: PF( n1 => initial_pf.n1, n2 => initial_pf.n2, n3 => initial_pf.n3 ); -- [A] work_pf sized with initial_pf constraints begin PF_Data(work_pf):= initial_pf; -- [B] copy base data end; ______________________________________________________________ Gautier -- http://www.mysunrise.ch/users/gdm/index.htm Ada programming -- http://www.mysunrise.ch/users/gdm/gsoft.htm NB: For a direct answer, e-mail address on the Web site!