comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Tagged type more type safe than access to subprogram ?
Date: Fri, 30 Oct 2009 09:25:12 +0100
Date: 2009-10-30T09:25:09+01:00	[thread overview]
Message-ID: <1u5tn3ocre9xa.mp0ga48bvhg9.dlg@40tude.net> (raw)
In-Reply-To: 4ae9fece$0$6590$9b4e6d93@newsspool3.arcor-online.net

On Thu, 29 Oct 2009 21:45:02 +0100, Georg Bauhaus wrote:

> Dmitry A. Kazakov schrieb:
>> On Thu, 29 Oct 2009 04:00:29 -0700 (PDT), Hibou57 (Yannick Duchêne) wrote:
>> 
>>> On 28 oct, 09:55, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
>>> wrote:
>>>> An access to subprogram is a poor-man's closure. Let's ignore "access" part
>>>> and consider a pure downward closure (as it should have been in Ada).
>> 
>>> “ As this should have been in Ada ” ? What were you to mean ? I've
>>> always though real closures are not possible with such structures as
>>> Ada provides, except at package level — which is especially the case
>>> when a package can have multiple instances... but only at package
>>> level. Isn't it ?
>> 
>> I meant downward closures. [...]
> 
>> BTW, in Ada 83, there waa no access to subprogram, so we used tasks instead
>> (where a subprogram had to be a non-generic parameter).
> 
> Tagged types may come close to a solution sometimes.

Yes, I am using this pattern very often. But:

1. There were no tagged types in Ada 83

2. In Ada 95 tagged types were in effect strictly library-level. This
restriction was lifted only in Ada 2005, too late to stop the "access-to
everything cancer".

3. The language is too heavy when it comes to create a singleton object
overriding one or two abstract primitive operations. There should be
short-cuts for that.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



      reply	other threads:[~2009-10-30  8:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-28  7:51 Tagged type more type safe than access to subprogram ? Hibou57 (Yannick Duchêne)
2009-10-28  8:55 ` Dmitry A. Kazakov
2009-10-29 11:00   ` Hibou57 (Yannick Duchêne)
2009-10-29 17:54     ` Dmitry A. Kazakov
2009-10-29 20:45       ` Georg Bauhaus
2009-10-30  8:25         ` Dmitry A. Kazakov [this message]
replies disabled

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