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,2e2db8edf2656165 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!irazu.switch.ch!news-zh.switch.ch!switch.ch!cern.ch!news From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Constructing an object Date: Thu, 22 Sep 2005 09:45:24 +0200 Organization: CERN - European Laboratory for Particle Physics Message-ID: References: <1lw8oz33ao529.12ep5ay7rg4oc$.dlg@40tude.net> NNTP-Posting-Host: abpc10883.cern.ch Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sunnews.cern.ch 1127375124 9577 (None) 137.138.37.241 X-Complaints-To: news@sunnews.cern.ch User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20050913 Red Hat/1.7.10-1.4.2.SL3 X-Accept-Language: en-us, en In-Reply-To: Xref: g2news1.google.com comp.lang.ada:5023 Date: 2005-09-22T09:45:24+02:00 List-Id: Maciej Sobczak wrote: >> 3. The default values: > > OK, this solves some of the cases. In general, however, by > "initialization" I mean performing some actions (not just inventing > values), like acquire on external resources. And I just realized that I don't have to use constants as default values, thay can come from functions... >> 4. Initialization enforcement via discriminants: >> >> 4.a. Discriminants as members: ... and here those functions could even take the discriminant as a parameter: function Get_New(Param : in SomeType) returns OtherType is begin -- ... end Get_Value; type Record (Param : SomeType) is record X : OtherType := Get_New(Param); end record; A : Record(7); This way, I can execute some action in order to initialize the object, and even use some parameters. Further questions: Are there any restrictions on SomeType? -- Maciej Sobczak : http://www.msobczak.com/ Programming : http://www.msobczak.com/prog/