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-20 13:14:15 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!newspump.monmouth.com!newspeer.monmouth.com!newsfeed.icl.net!newsfeed.fjserv.net!diablo.theplanet.net!mephistopheles.news.clara.net!news.clara.net!lon1-news.nildram.net!news-peer.gradwell.net!not-for-mail Newsgroups: comp.lang.ada From: porton@ex-code.com (Victor Porton) Date: Tue, 21 Jan 2003 02:07:29 +0500 References: <3e274cad$0$33929$bed64819@news.gradwell.net> Organization: Extreme Code Software (http://ex-code.com) Subject: Re: Problem Eliminating constructors Mime-Version: 1.0 X-Newsreader: knews 1.0b.1 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-URL: http://www.ex-code.com/ Message-ID: <3e2c66a7$0$33929$bed64819@news.gradwell.net> NNTP-Posting-Date: 20 Jan 2003 21:14:15 GMT NNTP-Posting-Host: 195.149.39.13 X-Trace: 1043097255 news.gradwell.net 33929 mail2news/195.149.39.13 X-Complaints-To: news-abuse@gradwell.net Xref: archiver1.google.com comp.lang.ada:33249 Date: 2003-01-20T21:14:15+00:00 List-Id: 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. Well, currently I switched to initialization by calling a procedure. It would be nice if Ada0X would allow to make a primitive operation non-virtual. E.g. we can introduce "pragma Freeze(TYPE)".