comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Ada Alternatives to Unrestricted_Access
Date: Sun, 11 Mar 2018 19:12:45 +0100
Date: 2018-03-11T19:12:45+01:00	[thread overview]
Message-ID: <p83riu$a6a$1@dont-email.me> (raw)
In-Reply-To: <a185d3c8-63cf-4c38-9546-55a64387476f@googlegroups.com>

On 03/11/2018 06:33 PM, Jere wrote:
> 
> The problem I run into with this provided code base, is that it
> often iterates over a constant view of the container.  In those cases,
> Default_Iterator cannot have a mode of "in out" as you just get the error
> 
> "variable container expected"

I can't say I've ever done that.

> It's kind of an odd place to be.  You want the tamper checks to ensure
> container safety/correctness, which potentially requires
> Default_Iterator to have mode "in out" but you also don't want to
> restrict the Container to only be used in mutable situations.  If
> you want to use a container in non mutable situations, you need
> Default_Iterator to have mode "in".  Without tamper checks, everything
> can be mode "in" and happy.

So you want to bypass one kind of check in order to have another? Is it possible 
to tamper with a constant container?

I presume this code was written for an earlier version of the language, and now 
you want to bolt on this neat new feature of Ada 12. It seems its design and 
implementation are not compatible with user-defined iteration. It appears there 
are 2 clean solutions:

1. Do nothing. You don't need this form of iteration. The existing ways of 
iterating over the container work fine.

2. Revisit the design and modify the code so it's compatible with user-defined 
iteration.

Trying to use solution 1.5 is going to be messy.

-- 
Jeff Carter
"Sir Robin the not-quite-so-brave-as-Sir-Lancelot,
who had nearly fought the Dragon of Angnor,
who nearly stood up to the vicious Chicken of Bristol,
and who had personally wet himself at the
Battle of Badon Hill."
Monty Python & the Holy Grail
68

  reply	other threads:[~2018-03-11 18:12 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-07 20:11 Ada Alternatives to Unrestricted_Access Jere
2018-03-07 20:38 ` Dmitry A. Kazakov
2018-03-07 22:29   ` Jere
2018-03-08  8:27     ` Dmitry A. Kazakov
2018-03-09  0:43       ` Jere
2018-03-09  0:52         ` Jere
2018-03-09  8:28           ` Dmitry A. Kazakov
2018-03-11  0:31             ` Jere
2018-03-08  3:18 ` gautier_niouzes
2018-03-09  0:41   ` Jere
2018-03-08 17:51 ` Jeffrey R. Carter
2018-03-09  0:36   ` Jere
2018-03-09 16:46     ` Jeffrey R. Carter
2018-03-11  0:38       ` Jere
2018-03-11  9:57         ` Jeffrey R. Carter
2018-03-11 10:44           ` Dmitry A. Kazakov
2018-03-11 14:31           ` Jere
2018-03-11 15:49             ` Jeffrey R. Carter
2018-03-11 17:33               ` Jere
2018-03-11 18:12                 ` Jeffrey R. Carter [this message]
2018-03-11 19:53                   ` Jere
2018-03-12 16:28                     ` Jeffrey R. Carter
2018-03-11 18:27                 ` Niklas Holsti
2018-03-11 20:07                   ` Jere
2018-03-12 23:35                     ` Randy Brukardt
2018-03-12 23:30         ` Randy Brukardt
2018-03-13  7:46           ` Niklas Holsti
replies disabled

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