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,81bb2ce65a3240c3 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.232.42 with SMTP id tl10mr10763876pbc.7.1335579449364; Fri, 27 Apr 2012 19:17:29 -0700 (PDT) Path: r9ni106552pbh.0!nntp.google.com!news2.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: What would you like in Ada202X? Date: Fri, 27 Apr 2012 19:17:28 -0700 (PDT) Organization: http://groups.google.com Message-ID: <32386740.398.1335579448929.JavaMail.geo-discussion-forums@ynjw9> References: <3637793.35.1335340026327.JavaMail.geo-discussion-forums@ynfi5> <13849842.838.1335485882969.JavaMail.geo-discussion-forums@vbai3> <134641.307.1335542673651.JavaMail.geo-discussion-forums@pbrx5> <2867357.127.1335561067669.JavaMail.geo-discussion-forums@ynee1> <25142265.182.1335570050700.JavaMail.geo-discussion-forums@vbez18> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 X-Trace: posting.google.com 1335579449 13703 127.0.0.1 (28 Apr 2012 02:17:29 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 28 Apr 2012 02:17:29 +0000 (UTC) In-Reply-To: <25142265.182.1335570050700.JavaMail.geo-discussion-forums@vbez18> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2012-04-27T19:17:28-07:00 List-Id: On Friday, April 27, 2012 4:40:50 PM UTC-7, sbelm...@gmail.com wrote: > On Friday, April 27, 2012 7:18:34 PM UTC-4, Randy Brukardt wrote: >=20 > > Note that Ada 95 did that (implicitly) for the Initialize/Adjust/Finali= ze=20 > > routines of type Controlled. We made that more explicit in Ada 2005, bu= t=20 > > that did not reflect any language change. This is another example of a= =20 > > "hook". >=20 > But this, along with the other hooks, seems like a relic of a single-inhe= ritance version of Ada. A much (well, perhaps just slightly) better versio= n would be to split things up into multiple interfaces. For instance, inst= ead of just extending Ada.Finalization and getting all three hooks regardle= ss, you split the three routines into three different one-subprogram interf= aces. Types extend exactly which ones they want, and not the ones they don= 't. If you don't want Finalization or Initialization, then you only extend= the Ada.Finalization.Adjustable (e.g.), and you no longer have usless subp= rograms being called to perform usless actions, and any mistakes (forgettin= g to implement one, trying to implement another, etc) are caught at compile= time. Types get exactly what they ask for, and nothing they don't. Why l= eave to a human what can be done by the compiler? How is this possibly going to work with class-wide types? Sure, it's not c= ommon to call Initialize/Adjust/Finalize directly in a program, but conside= r some other abstract type T that has procedure methods A, B, and C. For o= ne type T1 derived from T, it makes sense that A and B would be no-ops. Fo= r another type T2 derived from T, A and B would do something. Maybe for an= other derived type T3, A would do something but C would be a no-op. Now yo= u want to write a procedure that takes an argument Obj of type T'Class (or = access-to-T'Class), and that procedure wants to call method A and/or B and/= or C (and is perfectly fine with one or more of those procedures being no-o= ps). How can it do this, if you say A, B, and C can't be defined as primit= ives of type T but have to be defined in some other interface or something = like that? Whatever solution you're going to come up with, it's not worth = it. It would require a lot of rigmarole to implement a rather common situa= tion, and requiring all that extra junk seems likely to make things more er= ror-prone than the problem you're trying to solve. =20 -- Adam