comp.lang.ada
 help / color / mirror / Atom feed
* Update_Element Spec. in Containers.Indefinite_Hashed_Maps
@ 2005-12-20 18:00 Anh Vo
  2005-12-20 21:01 ` Randy Brukardt
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Anh Vo @ 2005-12-20 18:00 UTC (permalink / raw)


The Update_Element procedure specification has two paramters, Position
and Process as implemented in GNAT-GPL. The one in the LRM 2005 has
three paramters, Container as the additional and first paramter. Which
one is the right one? 

AV




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Update_Element Spec. in Containers.Indefinite_Hashed_Maps
  2005-12-20 18:00 Update_Element Spec. in Containers.Indefinite_Hashed_Maps Anh Vo
@ 2005-12-20 21:01 ` Randy Brukardt
  2005-12-20 21:04 ` Georg Bauhaus
  2005-12-21  3:21 ` Matthew Heaney
  2 siblings, 0 replies; 8+ messages in thread
From: Randy Brukardt @ 2005-12-20 21:01 UTC (permalink / raw)


"Anh Vo" <anhvofrcaus@gmail.com> wrote in message
news:1135101609.527495.321500@g49g2000cwa.googlegroups.com...
> The Update_Element procedure specification has two paramters, Position
> and Process as implemented in GNAT-GPL. The one in the LRM 2005 has
> three paramters, Container as the additional and first paramter. Which
> one is the right one?

The Ada Amendment isn't quite finalized yet, so it still is changing
slightly. That means that older versions are likely to be somewhat out of
sync.

The change adding "Container" parameters to some operations, and changing
the modes of others, was approved at the York ARG meeting, and was made
shortly thereafterwards. (There were a dozen or so other changes approved,
including changes in the formal parameters for some of the generics).

The reason for this particular change is to ensure that a writeable
container is present for every operation that modifies a container. With the
original specification, you could modify a constant container (such as an
'in' parameter) simply by retrieving an appropriate cursor and then calling
Update_Element. We don't want to make modifying constants easy!

                               Randy.






^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Update_Element Spec. in Containers.Indefinite_Hashed_Maps
  2005-12-20 18:00 Update_Element Spec. in Containers.Indefinite_Hashed_Maps Anh Vo
  2005-12-20 21:01 ` Randy Brukardt
@ 2005-12-20 21:04 ` Georg Bauhaus
  2005-12-20 21:15   ` Anh Vo
  2005-12-21  3:21 ` Matthew Heaney
  2 siblings, 1 reply; 8+ messages in thread
From: Georg Bauhaus @ 2005-12-20 21:04 UTC (permalink / raw)


On Tue, 2005-12-20 at 10:00 -0800, Anh Vo wrote:
> The Update_Element procedure specification has two paramters, Position
> and Process as implemented in GNAT-GPL. The one in the LRM 2005 has
> three paramters, Container as the additional and first paramter. Which
> one is the right one? 

As for containers, GNAT GPL edition is a wee bit behind, Matt has
added a few updates to match LRM A.18. GCC 4.1 has the one taking
three parameters.

-- Georg 





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Update_Element Spec. in Containers.Indefinite_Hashed_Maps
  2005-12-20 21:04 ` Georg Bauhaus
@ 2005-12-20 21:15   ` Anh Vo
  0 siblings, 0 replies; 8+ messages in thread
From: Anh Vo @ 2005-12-20 21:15 UTC (permalink / raw)


Georg Bauhaus wrote:
> On Tue, 2005-12-20 at 10:00 -0800, Anh Vo wrote:
> > The Update_Element procedure specification has two paramters, Position
> > and Process as implemented in GNAT-GPL. The one in the LRM 2005 has
> > three paramters, Container as the additional and first paramter. Which
> > one is the right one?
>
> As for containers, GNAT GPL edition is a wee bit behind, Matt has
> added a few updates to match LRM A.18. GCC 4.1 has the one taking
> three parameters.
>

Thanks both Randy and Georg for your quick reply. I am looking forward
to reading the LRM A. 18.

AV




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Update_Element Spec. in Containers.Indefinite_Hashed_Maps
  2005-12-20 18:00 Update_Element Spec. in Containers.Indefinite_Hashed_Maps Anh Vo
  2005-12-20 21:01 ` Randy Brukardt
  2005-12-20 21:04 ` Georg Bauhaus
@ 2005-12-21  3:21 ` Matthew Heaney
  2005-12-21  6:03   ` Georg Bauhaus
  2005-12-22 23:47   ` Anh Vo
  2 siblings, 2 replies; 8+ messages in thread
From: Matthew Heaney @ 2005-12-21  3:21 UTC (permalink / raw)


"Anh Vo" <anhvofrcaus@gmail.com> writes:

> The Update_Element procedure specification has two paramters, Position and
> Process as implemented in GNAT-GPL. The one in the LRM 2005 has three
> paramters, Container as the additional and first paramter. Which one is the
> right one?

The version with three parameters is correct.  You appear to have an older
compiler.

As was mentioned elsewhere on this thread, there is a delay (usually a few
weeks) between the time I change the GNAT sources at AdaCore, and the time the
changes migrate into the GCC tree.

Eventually I'll update the reference implementation at
<http://charles.tigris.org> , but for now maintenance of the GNAT
implementation is my highest priority.  The tigris site will also be a good
place to try out alternative implementations (incremental hashing comes to
mind).

Note that if you have an older version of GNAT, then it's not hard to modify
your copy of the container library sources to match what's in the latest RM
draft.  Just find the ada include directory in your distribution, fix the file
in which you're interested, and compile the modified sources with -gnatg.
(Would -a work too?)

If you need the latest container sources now, and you're unsure what to do,
just drop me a line and I can step you through the necessary changes.

-Matt

P.S. I just learned today that AI-391 was approved, which means you'll be able
to say:

declare
  package Vector_Types is new A.C.Vectors (IT, ET);
  type VT is new Vector_Types.Vector with null record;
  -- not necessary to override functions returning type Vector
begin

Ditto for type Set.  This allows one to use the "transitivity of visibility"
technique mentioned in the Ada83 Rationale for containers too.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Update_Element Spec. in Containers.Indefinite_Hashed_Maps
  2005-12-21  3:21 ` Matthew Heaney
@ 2005-12-21  6:03   ` Georg Bauhaus
  2005-12-21 14:58     ` Matthew Heaney
  2005-12-22 23:47   ` Anh Vo
  1 sibling, 1 reply; 8+ messages in thread
From: Georg Bauhaus @ 2005-12-21  6:03 UTC (permalink / raw)


On Wed, 2005-12-21 at 03:21 +0000, Matthew Heaney wrote:

> Note that if you have an older version of GNAT, then it's not hard to modify
> your copy of the container library sources to match what's in the latest RM
> draft.  Just find the ada include directory in your distribution, fix the file
> in which you're interested, and compile the modified sources with -gnatg.
> (Would -a work too?)

Did this and it sort of worked.

BTW, what is the state of -gnata WRT GNAT's Ada.Containers?



-- Georg 





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Update_Element Spec. in Containers.Indefinite_Hashed_Maps
  2005-12-21  6:03   ` Georg Bauhaus
@ 2005-12-21 14:58     ` Matthew Heaney
  0 siblings, 0 replies; 8+ messages in thread
From: Matthew Heaney @ 2005-12-21 14:58 UTC (permalink / raw)


Georg Bauhaus <bauhaus@futureapps.de> writes:

> BTW, what is the state of -gnata WRT GNAT's Ada.Containers?

Works great.  If you attempt to use a dangling cursor, then it should get
caught either by normal (non-assertion) checks, or by the extra checks enabled
by -gnata.

Also note that the indefinite forms will have better dangling-cursor detection,
since the container can take advantage of the fact that keys and elements are
allocated.  (If the internal pointer is null, then that indicates a problem.)
A good rule-of-thumb is to temporarily switch to an indefinite form, if you're
having a problem that you think is container-related.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Update_Element Spec. in Containers.Indefinite_Hashed_Maps
  2005-12-21  3:21 ` Matthew Heaney
  2005-12-21  6:03   ` Georg Bauhaus
@ 2005-12-22 23:47   ` Anh Vo
  1 sibling, 0 replies; 8+ messages in thread
From: Anh Vo @ 2005-12-22 23:47 UTC (permalink / raw)


Matthew Heaney wrote:
> "Anh Vo" <anhvofrcaus@gmail.com> writes:
>
> Note that if you have an older version of GNAT, then it's not hard to modify
> your copy of the container library sources to match what's in the latest RM
> draft.  Just find the ada include directory in your distribution, fix the file
> in which you're interested, and compile the modified sources with -gnatg.
> (Would -a work too?)
>
> If you need the latest container sources now, and you're unsure what to do,
> just drop me a line and I can step you through the necessary changes.

Thanks for your offer. Actually, I can get it from gcc-4.1.0 /
gcc-4.2.0. I was looking at the Geneology example under GNAT-GPL 2005
compiler. Then, I accidentally compile this example under gcc-4.1.0
(Red Hat). Of course, the compilation failed due parameters mismatched.
This triggered my curiosity to post the question.

Wishing everyone a happy and healthy holiday - Christmas, new year, etc
...

AV




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-12-22 23:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-20 18:00 Update_Element Spec. in Containers.Indefinite_Hashed_Maps Anh Vo
2005-12-20 21:01 ` Randy Brukardt
2005-12-20 21:04 ` Georg Bauhaus
2005-12-20 21:15   ` Anh Vo
2005-12-21  3:21 ` Matthew Heaney
2005-12-21  6:03   ` Georg Bauhaus
2005-12-21 14:58     ` Matthew Heaney
2005-12-22 23:47   ` Anh Vo

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