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=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!gandalf.srv.welterde.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Elaboration Question Date: Fri, 2 Jan 2015 16:16:43 -0600 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: NNTP-Posting-Host: rrsoftware.com X-Trace: loke.gir.dk 1420237004 491 24.196.82.226 (2 Jan 2015 22:16:44 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 2 Jan 2015 22:16:44 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: number.nntp.giganews.com comp.lang.ada:191627 Date: 2015-01-02T16:16:43-06:00 List-Id: "Simon Wright" wrote in message news:lywq55pqej.fsf@pushface.org... > Hubert writes: ... >> So may question is, is it better to just leave those variables >> unitialized and then initialize them later for instance: >> >> A : Integer; >> >> PROCEDURE Initialize IS >> BEGIN >> A:= 0; >> END Initialize; >> >> Would that be generally better? > > I would say not. There might, after all, be a chain of Initialize calls > required; very complicated to manage. I agree. Plus you have the possibility of forgetting to call Initialize for some package, in which case weird things probably will happen. Having said that, it's not always practical to get packages to elaborate in a particular order. If initialization is significant, it may make sense to use an explicit routine. For instance, in Janus/Ada, temporary files have to be read in a particular order, so we ended up using Initialize subprograms to do that (otherwise, packages that don't need to know about each other for any other reason end up coupled). But for smaller initializing (like setting things to an empty state), I think you should always use elaboration. Randy.