comp.lang.ada
 help / color / mirror / Atom feed
From: Jacob Sparre Andersen <sparre@nbi.dk>
Subject: Re: Mutating elements of constant list using a container element iterator
Date: Wed, 05 Aug 2015 09:43:49 +0200
Date: 2015-08-05T09:43:49+02:00	[thread overview]
Message-ID: <87vbcuyybu.fsf@adaheads.sparre-andersen.dk> (raw)
In-Reply-To: 0c1904af-8ede-4694-a50a-ac9f60d7dc63@googlegroups.com

martinbbjerregaard@gmail.com writes:

> Mutating elements of a constant container in a "for ... of ... loop"
> is possible with the "standard" container types but not the indefinite
> or bounded containers:

The trick is to assign a new value to the whole object, and not just a
component of it:

   for Item of V2 loop
      Item := (Value => 0);
   end loop;

I'm not sure exactly why there is a difference.

> Is this a bug?

It might be.  I don't understand the indefinite containers well enough to
be able to explain what happens.

Greetings,

Jacob
-- 
"The problem with America is stupidity. I'm not saying there
 should be a capital punishment for stupidity, but why don't
 we just take the safety labels off of everything and let
 the problem solve itself?"


  parent reply	other threads:[~2015-08-05  7:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-04 23:56 Mutating elements of constant list using a container element iterator martinbbjerregaard
2015-08-05  7:32 ` Egil H H
2015-08-05 11:23   ` martinbbjerregaard
2015-08-05  7:43 ` Jacob Sparre Andersen [this message]
2015-08-05 11:35 ` martinbbjerregaard
2015-08-06 19:02 ` 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