comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: User Defined Storage Pool : did you ever experiment with it ?
Date: Mon, 7 Feb 2011 16:18:51 -0600
Date: 2011-02-07T16:18:51-06:00	[thread overview]
Message-ID: <iipr4e$sh5$1@munin.nbi.dk> (raw)
In-Reply-To: op.vqhzfuuyule2fv@garhos

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2230 bytes --]

"Yannick Duch�ne (Hibou57)" <yannick_duchene@yahoo.fr> wrote in message 
news:op.vqhzfuuyule2fv@garhos...
>Le Tue, 25 Jan 2011 02:36:27 +0100, Randy Brukardt <randy@rrsoftware.com> 
>a �crit:
>> Can't answer that, but we did consider adding such a feature to Ada 2012.
>> Eventually we decided on a more general purpose user-defined 
>> dereferencing
>> capability instead.

>You mean this is already part of the actual or next to come Ada 2012 ?

We expect it to be, although it isn't finished and it will have to be 
finished by the end of this month (as with all work on Ada 2012) in order to 
be included.

See AI05-0139-2. The "Reference" aspect combines with access discriminants 
and controlled types to give effectively a user-defined dereferencing 
mechanism.

The primary problem with user-defined dereferencing is controlling the 
lifetime of the returned access value -- we don't want it copied outside of 
the control of the underlying container abstraction. In addition, it is 
important that the container be able to get control twice: once when the 
dereference is created, and once when it is destroyed. The latter is needed 
in cases of persistence or other kinds of locking. (In the case of 
persistence, the object must be available in memory so long as a reference 
to it is valid, but it can be pushed back to the backing store once the 
references are all gone. Another example is a the tampering check of the Ada 
containers, which prevent the object of the reference from disappearing 
while the reference exists.)

It turns out that the mechanism needed already exists in the language, in 
the form of access discriminants. In addition, the object containing the 
access discriminant can be controlled, thus giving control upon destruction 
of the object (and the reference). So the only problem is the terrible 
syntax of such a dereference. The Reference aspect allows us to eliminate 
that.

Combined with the indexing aspect, you'll be able to write something like:

     Foo(1).Bar := 10;

For a vector container Foo whose elements are a record type with a component 
Bar. And even:

    Text_Map ("Ada").Count := 1;

For an indefinite map.

                                       Randy.








  parent reply	other threads:[~2011-02-07 22:18 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-22  0:04 User Defined Storage Pool : did you ever experiment with it ? Yannick Duchêne (Hibou57)
2011-01-22  0:55 ` Adam Beneschan
2011-01-22  1:42   ` Yannick Duchêne (Hibou57)
2011-01-22  5:19   ` Randy Brukardt
2011-01-22  8:49 ` Dmitry A. Kazakov
2011-01-22  9:47 ` User Defined Storage Pool : Example anon
2011-01-22  9:54 ` User Defined Storage Pool : did you ever experiment with it ? AdaMagica
2011-01-24  9:57   ` Yannick Duchêne (Hibou57)
2011-01-24 10:48   ` Mark Lorenzen
2011-01-22 15:13 ` Simon Wright
2011-01-24  9:56   ` Yannick Duchêne (Hibou57)
2011-01-24 16:09     ` Simon Wright
2011-01-24 23:58   ` Yannick Duchêne (Hibou57)
2011-01-22 22:17 ` Fritz Wuehler
2011-01-24  9:52   ` Yannick Duchêne (Hibou57)
2011-01-24 14:20     ` Bill Findlay
2011-01-24  9:25 ` Ludovic Brenta
2011-01-24  9:43   ` Yannick Duchêne (Hibou57)
2011-01-24 13:43     ` Emmanuel Briot
2011-01-24 16:48       ` Dirk Craeynest
2011-01-25  1:16         ` Yannick Duchêne (Hibou57)
2011-01-24 11:46 ` Jacob Sparre Andersen
2011-01-24 23:51   ` Yannick Duchêne (Hibou57)
2011-02-10  7:59     ` Jacob Sparre Andersen
2011-02-13 15:56       ` AdaMagica
2011-02-13 19:10         ` Simon Clubley
2011-01-24 14:04 ` Timo Warns
2011-01-24 23:34   ` Yannick Duchêne (Hibou57)
2011-01-25  0:14     ` Yannick Duchêne (Hibou57)
2011-01-25  1:36       ` Randy Brukardt
2011-02-06 20:05         ` Yannick Duchêne (Hibou57)
2011-02-07 22:09           ` Randy Brukardt
2011-02-07 22:18           ` Randy Brukardt [this message]
2011-02-07 22:59             ` Maciej Sobczak
2011-02-07 23:57               ` Shark8
2011-02-08 13:40                 ` Maciej Sobczak
2011-02-10  2:08               ` Randy Brukardt
2011-02-08  9:08             ` Alex R. Mosteo
2011-01-26 20:13 ` Warren
replies disabled

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