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,e859f774bbb3dfb3 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Wed, 25 Jun 2008 12:32:05 +0200 From: Georg Bauhaus User-Agent: Thunderbird 2.0.0.14 (Macintosh/20080421) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: another way to shoot yourself in the foot? References: <54157920-377a-441b-9b0b-f0c4f9ddffec@f36g2000hsa.googlegroups.com> <54435596-5e7f-4686-a2b7-1e22d7c4b186@p25g2000hsf.googlegroups.com> <483ugmvkl2ea.1hrqsq7ru4t1x$.dlg@40tude.net> <12dhu8e1w5ac9.1s9hzkf9d2rsy$.dlg@40tude.net> <3bc1018b-b275-4a59-8302-6a3262766f63@z24g2000prf.googlegroups.com> <6ug5vhz5j1e4$.1lqpd52jz6qry.dlg@40tude.net> <1s88o46xl9o9b$.1e88zxl9es93z$.dlg@40tude.net> <486184b7$0$6615$9b4e6d93@newsspool2.arcor-online.net> <1ilzy5ufjyn6p$.cu5078bqe0mj$.dlg@40tude.net> In-Reply-To: <1ilzy5ufjyn6p$.cu5078bqe0mj$.dlg@40tude.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <48621ea8$0$6556$9b4e6d93@newsspool3.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 25 Jun 2008 12:32:08 CEST NNTP-Posting-Host: 46bf2a25.newsspool3.arcor-online.net X-Trace: DXC=jLZiJVBi3d1TQL:hoD@>T?McF=Q^Z^V384Fo<]lROoR18kF:Lh>_cHTX3j=DUacTFDZi29 X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:867 Date: 2008-06-25T12:32:08+02:00 List-Id: Dmitry A. Kazakov schrieb: >> And now automatic operations like Initialize and Finalize, >> hooked on a single type (and possibly discriminants---does >> GNAT like at last :-) are supposed to be the solution of >> all data management? > > Yes they are. Note that constructing/destructing hooks have different rules > of composition, like aggregates and assignments have. They are not > overridden they are extended. (Ada's Finalization is bogus, alas). Just one point ad hoc. Taking the notion of construction further, define the concept of initialization. In general, initialization of an object Obj_1 of type T1 may logically be related to the observable state of Obj_2 of type T2, where observable state means result of operations or (component) values. As these states change while a program is running, the dependences may not always be the same. Obj_1's initialization may logically depend on F(Obj_1, ..., Obj_N), or more generally on F(G_1(Obj_1_1, ..., Obj_M_1), ... G_J(Obj_1_J, ..., Obj_M_J)). for some finite sets of objects and functions. Basically, on anything that can be programmed into an expression used for initializing. It may be cross unit, involve P98.T19 or not, or A.B.T42 only if G_17(Obj_127) > 666 etc. This "net of dependence" would mean that a constructor will have to adjust its behavior to the current state of the program. Adjustment may be realized through dispatching to a load of objects, other constructors, etc. etc. etc. IOW, every constructor becomes a huge factory in disguise. It has to perform case distinction. How is this seemingly special construction different from just normal programming? The only added value of constructors that I can see is that I can point to a few functions which "point to" all this. A good addition, and not a small one. But should we therefore abandon all other means of initializing things? If construction turns out to be mostly normal programming, why not use plain old language features in addition to specialized constructor programming? For example, use local scopes and visibility for providing (computed) initial values, even though a scope is not an operation of a type, like a construtor function is.