TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Simon Wright <[log in to unmask]>
Reply To:
Date:
Fri, 27 Sep 2002 21:31:56 +0100
Content-Type:
text/plain
Parts/Attachments:
text/plain (54 lines)
Hello all,

This is a question for users of the BCs. Some of you may get it twice;
apologies.

I've been investigating giving some of the Containers discriminants to
specify number of hash buckets / maximum size for bounded Containers.

This makes bounded Maps look like

   generic
      with function Hash (K : Key) return Natural is <>;
      Buckets : Positive;
      Maximum_Size : Positive;
   package BC.Containers.Maps.Bounded is

      type Unconstrained_Map
        (Number_Of_Buckets : Positive;
         Maximum_Size : Positive) is new Abstract_Map with private;

      subtype Map is Unconstrained_Map (Number_Of_Buckets => Buckets,
                                        Maximum_Size => Maximum_Size);

For many purposes this is a drop-in replacement. However, there are
some side-effects:

* although I write "function Null_Container return Unconstrained_Map;",
  what you actually get is a Map (ie, it's constrained).

  Null_Container was provided for people who wanted to provide
  initializers for records containing Containers.

* I can't see how to provide the Guarded forms, at least without a
  reversion to the old way of doing things where each Guarded
  container would have required a child package for each Form.


I would rather like to drop the concurrency support (Guarded and
Synchronized forms), because

* Guarded forms will take a lot of effort to provide, see above.

* I've only provided a few Synchronized forms, and there haven't been
  any requests for more.

* I don't believe that I can provide all the options you might need
  for your particular problems -- I certainly didn't manage it for
  myself! If you need containers to support some concurrent
  abstraction, use them with protected types and tasks do do exactly
  what _you_ want.


Any comments gratefully received.

ATOM RSS1 RSS2