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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Should weak counted reference be able to be strengthened? Date: Wed, 26 Nov 2014 10:28:03 +0100 Organization: cbb software GmbH Message-ID: <1kqnn4e05fbl2$.1wv2gk39uwsha.dlg@40tude.net> References: <7d9r3whe43z8$.1f2l3n5cz0zh0$.dlg@40tude.net> <1tlppwq452jbq$.d1y3trfego8b$.dlg@40tude.net> <1xbl1kdcf9at5.1dfv4py4kvx0o.dlg@40tude.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: nyHeW7QjJmC1odUjK4LkDA.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:23737 Date: 2014-11-26T10:28:03+01:00 List-Id: On Tue, 25 Nov 2014 15:49:49 -0600, Randy Brukardt wrote: > "Dmitry A. Kazakov" wrote in message > news:1xbl1kdcf9at5.1dfv4py4kvx0o.dlg@40tude.net... > ... >> Instead of introducing "crazy beautiful" implicit dereference, Ada 2012 >> should have delegation support for the patterns like this. > > Depending heavily on interfaces is a sure way to madness. :-) > > But the real problem here is I don't see any way to add "delegation support" > that actually saves much over the explicit version that you showed. We > certainly don't want *everything* to delegate (it has to be declared somehow > for the particular operations in question), Everything of course, unless explicitly overridden. > and because of overloading we > have to at least have the complete profile. That means an awful lot of > typing (and source text to read), and lots of chance for errors. Yes, which is why delegation and other means to compose overridden operations are needed. The programmer should be able to define things which happen implicitly when for example: type X is new Integer; This implicitly defines a lot of operations composed like: function "abs" (Value : X) return X = X (abs (Integer (Value)); It is not much different from how "sane" implicit dereference would work type Y is access Integer; function "abs" (Value : Y) return Integer = abs (Value.all); I don't know how to describe such things syntactically. That is a challenge. > In a sense, Ada 2012 has delegation support as one can use expression > functions that way. Yes, they could be viewed this way, but in my view they are too powerful. What I want is a more limited mechanism of composition which could be easily checked. The limitation is that the old body is used with an epilogue and/or a prologue and conversions are applied to the arguments and/or the result. If the body has to be changed, it must be overridden. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de