comp.lang.ada
 help / color / mirror / Atom feed
From: "Dan'l Miller" <optikos@verizon.net>
Subject: Re: Visibility of Indexing aspects
Date: Tue, 7 Aug 2018 08:13:03 -0700 (PDT)
Date: 2018-08-07T08:13:03-07:00	[thread overview]
Message-ID: <62cefa64-4855-4d51-9216-519f260349d4@googlegroups.com> (raw)
In-Reply-To: <pkafj7$5tg$1@franka.jacob-sparre.dk>

On Monday, August 6, 2018 at 4:46:16 PM UTC-5, Randy Brukardt wrote:
> "Dan'l Miller" wrote in message 
> news:cc25c794-5986-4f6e-9d5e-0ec20a4f47d0@googlegroups.com...
> ...
> >Ummmmmmmmm, what is so incredibly "expensive" about Element => 
> >Self.Data(Index)'Access in OP?
> 
> Nothing is expensive about *that*, but it's also very unsafe by itself (this 
> either prevents a container from ever reusuing memory, or essentially 
> requires being OK with dangling pointers and the erroneousness that they 
> cause).
> 
> Our requirement was that the user-defined dereference mechanism needs to be 
> safe (at least possible to be safe), and that requires the container to be 
> able to find out when the dereference ceases to exist. At that point, the 
> container can free the underlying memory if need be. (For an extreme 
> example, consider a persistent container, where the object only should exist 
> in memory so long as it is being used there.) The design that we came up 
> with for Ada 2012 uses finalization for this notification; we looked at 
> other mechanisms, but they would have had similar overhead.
> 
> The Ada containers use the finalization to clear the tampering check (which 
> prevents deleting of elements while the dereference exists); other uses are 
> possible, of course.
> 
> Without these sorts of checks, Ada containers would be no more safe than C 
> code. In particular, Ada programmers do not expect checked indexing to be 
> unsafe, so syntax of C(I) being unsafe would be a particular surprise.
> 
>                                     Randy.

My reference-counting of aliases in my reply above concurs with what you saying in this reply of yours.

Randy, you make a strong argument for the compiler/language tracking the lifetime of aliases instead of leaving it as a library and/or app-domain responsibility.

  parent reply	other threads:[~2018-08-07 15:13 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-02 20:31 Visibility of Indexing aspects Randy Brukardt
2018-08-03  0:43 ` Dan'l Miller
2018-08-03 20:56   ` Randy Brukardt
2018-08-03 21:32     ` Dan'l Miller
2018-08-06 21:46       ` Randy Brukardt
2018-08-06 22:12         ` Dmitry A. Kazakov
2018-08-07 15:13         ` Dan'l Miller [this message]
2018-08-07 22:41           ` Randy Brukardt
  -- strict thread matches above, loose matches on Subject: below --
2018-07-14 14:18 Jere
2018-07-14 17:04 ` Shark8
2018-07-14 18:29   ` Jere
2018-07-14 18:41     ` Dmitry A. Kazakov
2018-07-14 23:00     ` Shark8
2018-07-14 23:28       ` Jere
2018-07-15 14:41 ` AdaMagica
2018-07-15 15:33   ` Jere
2018-07-16  3:22     ` AdaMagica
2018-07-17  0:35       ` Jere
2018-07-17  9:46         ` AdaMagica
2018-07-17 10:11           ` AdaMagica
2018-07-20 12:08             ` Jere
2018-07-20 16:11               ` AdaMagica
2018-07-20 22:03                 ` Dan'l Miller
2018-07-20 22:07                 ` Jere
2018-07-21 10:33                   ` AdaMagica
2018-07-24  3:32                   ` Randy Brukardt
2018-07-24 17:15                     ` Dan'l Miller
2018-07-25  5:37                       ` Randy Brukardt
2018-07-25 18:26                         ` Dan'l Miller
2018-07-25 19:58                           ` AdaMagica
2018-07-25 20:57                             ` Dan'l Miller
2018-07-26  0:12                               ` Randy Brukardt
2018-07-26  2:41                                 ` Dan'l Miller
2018-07-26 19:09                                   ` Randy Brukardt
2018-07-26 20:31                                 ` Shark8
2018-07-26 21:25                                   ` Dan'l Miller
2018-07-27 22:05                                     ` Randy Brukardt
2018-07-28  0:35                                       ` Dan'l Miller
2018-07-27 21:58                                   ` Randy Brukardt
2018-07-20 22:23                 ` Jere
2018-07-20 22:25                   ` Jere
2018-07-21  5:58                   ` J-P. Rosen
replies disabled

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