comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Should weak counted reference be able to be strengthened?
Date: Wed, 26 Nov 2014 10:28:03 +0100
Date: 2014-11-26T10:28:03+01:00	[thread overview]
Message-ID: <1kqnn4e05fbl2$.1wv2gk39uwsha.dlg@40tude.net> (raw)
In-Reply-To: m52thu$956$1@loke.gir.dk

On Tue, 25 Nov 2014 15:49:49 -0600, Randy Brukardt wrote:

> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> 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

  reply	other threads:[~2014-11-26  9:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-21 11:07 Should weak counted reference be able to be strengthened? Natasha Kerensikova
2014-11-21 13:16 ` Dmitry A. Kazakov
2014-11-21 15:00   ` Natasha Kerensikova
2014-11-21 16:50     ` Dmitry A. Kazakov
2014-11-21 18:24       ` Natasha Kerensikova
2014-11-21 19:36         ` Dmitry A. Kazakov
2014-11-21 22:28           ` Randy Brukardt
2014-11-22  9:57           ` Natasha Kerensikova
2014-11-22 10:19             ` Dmitry A. Kazakov
2014-11-22 10:36               ` Natasha Kerensikova
2014-11-22 11:15                 ` Dmitry A. Kazakov
2014-11-21 22:39       ` Randy Brukardt
2014-11-21 22:49         ` Shark8
2014-11-22  8:42           ` Dmitry A. Kazakov
2014-11-22  8:42         ` Dmitry A. Kazakov
2014-11-24 22:15           ` Randy Brukardt
2014-11-25  8:36             ` Dmitry A. Kazakov
2014-11-25 21:49               ` Randy Brukardt
2014-11-26  9:28                 ` Dmitry A. Kazakov [this message]
2014-11-26 17:51                   ` brbarkstrom
2014-11-26 21:09                   ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox