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-Language: ENGLISH,ASCII X-Google-Thread: 103376,23777acd564d513b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-21 03:43:09 PST Message-ID: <3E2D3245.2060903@epfl.ch> Date: Tue, 21 Jan 2003 12:43:01 +0100 From: =?ISO-8859-1?Q?Rodrigo_Garc=EDa?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9) Gecko/20020513 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Problem Eliminating constructors References: <3e274cad$0$33929$bed64819@news.gradwell.net> <3e2c66a7$0$33929$bed64819@news.gradwell.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit NNTP-Posting-Host: lglpc31.epfl.ch X-Trace: epflnews.epfl.ch 1043149385 128.178.76.8 (21 Jan 2003 12:43:05 +0200) Organization: EPFL Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.vmunix.org!news.imp.ch!news.imp.ch!news-zh.switch.ch!epflnews.epfl.ch!not-for-mail Xref: archiver1.google.com comp.lang.ada:33286 Date: 2003-01-21T12:43:01+01:00 List-Id: Victor Porton wrote: > In article <3E2BDFD8.4070805@epfl.ch>, > Rodrigo Garc�a writes: > >>Victor Porton wrote: >> >>>package A is >>> >>> type A_Type is tagged >>> record >>> X: Integer; >>> end; >>> >>> function Create(X: Integer) return A_Type; -- guess what is the body >>> >>>end A; >>> >>>Then I have >>> >>>type B_Type is new A.A_Type with >>> record >>> Y: Integer; >>> end; >>> >>>Compiler requires me to override Create as the return type changes. >>>But it is meaningless as now I need Create with two parameters >>>instead of one. >>> >>>What to do? >> >> You do not need a constructor for this simple case. This will create >>an A_Type object and initialize X to value 5. >> >> declare >> My_A : A.A_Type := (X => 5); > > [skip] > > Oh, Rodrigo, I oversimplified the real situation. Initialization with > just aggregates is possible only in the example, really I need namely > constructor functions. I see... Have you tried with controlled types? Rodrigo