comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: GNAT for MS Visual Studio
Date: Mon, 8 Oct 2007 20:53:43 -0500
Date: 2007-10-08T20:53:43-05:00	[thread overview]
Message-ID: <feempr$5jg$1@jacob-sparre.dk> (raw)
In-Reply-To: 47088904.1090201@obry.net

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 5624 bytes --]

"Pascal Obry" <pascal@obry.net> wrote in message
news:47088904.1090201@obry.net...
> Randy Brukardt a �crit :
> > If you want dangerously unsafe containers, you are welcome to write them
> > yourself. But they don't belong in the standard (surely not as the sole
> > example of containers).
>
> I love those nonsense ! How can something that is only read be unsafe!!!
> And please between "dangerously unsafe containers" and "concurrent read
> access containers" I think there is some room. Why always having such
> strong and extreme position????

You have to consider the whole of the containers, not individual operations.
There are so many operations that having special rules for each one would be
a nightmare.

In any case, one size of container does not fit all. Having safe containers
that have write operations (whether they are used or not) requires having
checking, and that checkings needs to do bookkeeping. That means that safe
containers with multi-read access are going to require locks somewhere;
that's enough of a performance hit that it's dubious that it should be
required for the "base" containers.

If you are willing to have unsafe containers, then you don't need locks.
That's all I was talking about, and there is nothing extreme about that
position. The only thing that could be potentially called extreme is the
insistence on the possibility of safe containers. But is anyone really
against safety?

> Look it is not that unusual to have a container populated for a
> simulation that after initialization point does not need to be updated
> but only *read*. I have many concurrent simulations like this. I would
> have expected to be able to use the containers in this case.

The containers are only expected to be useful in 80% of the cases. The plan
is that there will be additional famiilies of containers to cover other
common use cases (particularly task-safe uses). We simply didn't have time
to expend effort on those additional families for the Amendment.

The standard rule in Ada, for *any* subprogram (in the absense of
documentation to the contrary), is that it must be called with
non-overlapping actual parameters if used from multiple tasks (or some
synchronization be used). You must never expect concurrent read to work
unless it is in the contract. It's most consistent to apply that to all of
the "base" library routines. (And yes, I think all user-written code should
either work when called by multiple tasks (for different objects) or be
documented that it doesn't work.)

> The recurrent saying "if you don't like this, do it yourself" in
> comp.lang.ada is just a big mistake for Ada as a whole. This decision is
> just counter intuitive for anybody having done a bit of computer science
:(

I don't buy this. Expecting that everything that you might want to do is
already done for you is a mark of a newbie. If it was that easy to program,
there would be no need for software professionals (or computer science).
There's a heck of a lot more to programming than just making a bunch of
subprogram calls.  The whole point is to know when it is better to do it
yourself, by knowing what the requirements of your application and whatever
is available.

In the specific case of the containers, there is no possibility of the
standard defining every possible combination of performance/memory
management/concurrency control (and I've probably forgotten some
properties). If you have strong needs in one of those areas, then you will
probably need to write something yourself. It is folly to expect the
predefined library to do everything for you. (Moreover, most of the time, it
is just premature optimization anyway; the predefined containers will be
fine.)

If you need concurrent access, then you should use the protected containers.
It's legitimate to gripe that they don't exist yet - it is annoying that the
standard for the protected containers isn't progressing faster, because it
is obvious that there is a need for such things. (It's tied up with the
bounded containers and various other forms. And so far as I know, no one has
tried to define in RM language what it means for a container to be
protected.)

> Anyway I had to say that :)
>
> Now maybe some operations could be made safe, like those not using
> cursors. For example, in Ada.Containers.Vectors:
>
>    function Element
>      (Container : Vector;
>       Index     : Index_Type) return Element_Type;
>
> Why this could not be made safe ?

It could, so long as you don't allow it to be combined with any other
container operation. Trying to define that in RM wording seems difficult to
me (all resource sharing issues are very hard to define in proper standards
language). Witness the thread on the meaning of 9.10.

Moreover, as I previously mentioned, it would be inconsistent with the
"normal" usage of Ada routines. It's a lot easier to remember to never
concurrently access a "basic" container than to try to remember the specific
cases where concurrent access is allowed. I personally think that such a
rule would lead to more (not less) container misuses, and quite likely
pressure on vendors to go beyond the standard in this area.

It would be easier to correctly use "protected" (task-safe) containers in
concurrent uses than ones that only allowed a small amount of concurrency.
Not everyone is an expert in concurrency, after all.

In any case, there is a master plan here; the problem is mostly a lack of
resources to execute that plan. (Sigh, I sound like a broken record on that
topic -- it applies equally to Ada itself and to Janus/Ada.)

                                  Randy.





  parent reply	other threads:[~2007-10-09  1:53 UTC|newest]

Thread overview: 103+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-06  2:20 GNAT for MS Visual Studio William J Thomas
2007-09-06  7:44 ` anon
2007-09-06  8:49   ` Rob Veenker
2007-09-06 11:12     ` William J Thomas
2007-09-11  3:15 ` Jeffrey Creem
2007-09-20  0:00 ` William J Thomas
2007-09-21  0:46   ` Randy Brukardt
2007-09-21  3:27     ` William J Thomas
2007-09-21 17:31       ` Markus E L
2007-09-21 18:13       ` Dmitry A. Kazakov
2007-09-22  1:42         ` Randy Brukardt
2007-09-22  1:59       ` Randy Brukardt
2007-09-22  5:19         ` Simon Wright
2007-09-22 14:42         ` Steve
2007-09-24  8:14           ` Jean-Pierre Rosen
2007-09-25  1:44             ` Steve
2007-09-25  6:41               ` Jean-Pierre Rosen
2007-09-25  8:29               ` Michael Bode
2007-09-25 18:00                 ` Jeffrey R. Carter
2007-09-25 18:31                   ` Michael Bode
2007-09-25 11:20               ` Markus E L
2007-09-26  2:23                 ` Steve
2007-09-26 12:21                   ` Markus E L
2007-09-28  0:49                     ` Randy Brukardt
2007-09-28  2:43                     ` Steve
2007-09-28  9:36                       ` Markus E L
2007-09-29 15:59                         ` Michael Bode
2007-09-29 16:50                           ` Markus E L
2007-09-26  6:58                 ` Ole-Hjalmar Kristensen
2007-09-26 13:35                   ` Steve
2007-09-26 14:06                     ` Markus E L
2007-09-27 18:26                       ` Michael Bode
2007-09-27 20:18                         ` Markus E L
2007-09-28  6:45                         ` Jean-Pierre Rosen
2007-09-29  9:18                           ` michael bode
2007-09-28  2:29                       ` Steve
2007-09-28  9:23                         ` Markus E L
2007-09-30 14:50                           ` Steve
2007-10-02  3:50                             ` Randy Brukardt
2007-10-02 11:06                               ` Peter C. Chapin
2007-10-02 20:38                               ` Maciej Sobczak
2007-10-02 20:45                                 ` Pascal Obry
2007-10-03 19:23                                   ` Maciej Sobczak
2007-10-03 19:40                                     ` Pascal Obry
2007-10-03 20:08                                       ` Maciej Sobczak
2007-10-04 20:18                                         ` Maciej Sobczak
2007-10-04 20:21                                           ` Pascal Obry
2007-10-05 13:25                                             ` Maciej Sobczak
2007-10-06 10:50                                               ` concurrent access to containers (was: GNAT for MS Visual Studio) Georg Bauhaus
2007-10-05 20:15                                         ` GNAT for MS Visual Studio Simon Wright
2007-10-06 14:47                                       ` Matthew Heaney
2007-10-06 15:03                                         ` Pascal Obry
2007-10-06 16:03                                           ` Dmitry A. Kazakov
2007-10-06 17:07                                             ` Pascal Obry
2007-10-06 18:30                                               ` Dmitry A. Kazakov
2007-10-06 20:32                                                 ` Maciej Sobczak
2007-10-07  7:35                                                   ` Dmitry A. Kazakov
2007-10-07 21:30                                                     ` Maciej Sobczak
2007-10-08  7:50                                                       ` Dmitry A. Kazakov
2007-10-08 10:32                                                         ` Maciej Sobczak
2007-10-08 13:39                                                           ` Maciej Sobczak
2007-10-08 15:10                                                           ` Dmitry A. Kazakov
2007-10-08 20:40                                                             ` Maciej Sobczak
2007-10-09  8:32                                                               ` Dmitry A. Kazakov
2007-10-06 16:17                                           ` Matthew Heaney
2007-10-07  3:19                                           ` Randy Brukardt
2007-10-07  7:21                                             ` Pascal Obry
2007-10-07  7:49                                               ` Dmitry A. Kazakov
2007-10-07 16:41                                               ` Georg Bauhaus
2007-10-07 17:44                                               ` Simon Wright
2007-10-08  9:52                                                 ` Georg Bauhaus
2007-10-08 10:42                                                   ` Maciej Sobczak
2007-10-08 10:59                                                     ` Georg Bauhaus
2007-10-08 11:07                                                     ` Georg Bauhaus
2007-10-08 18:44                                                     ` Pascal Obry
2007-10-08 15:21                                                   ` Dmitry A. Kazakov
2007-10-08 18:28                                                 ` Pascal Obry
2007-10-07 21:48                                               ` Maciej Sobczak
2007-10-07 22:27                                                 ` Jeffrey R. Carter
2007-10-08 21:10                                                   ` Simon Wright
2007-10-09  1:53                                               ` Randy Brukardt [this message]
2007-10-09 21:01                                                 ` Simon Wright
2007-10-09 22:48                                                   ` Randy Brukardt
2007-10-10  0:21                                                     ` Jeffrey R. Carter
2007-10-10  4:57                                                   ` Simon Wright
2007-10-10  7:46                                                   ` Dmitry A. Kazakov
2007-10-03  5:20                                 ` Licensing again (was Re: GNAT for MS Visual Studio) Simon Wright
2007-10-03  2:03                               ` GNAT for MS Visual Studio Steve
2007-09-28 14:48                         ` Ed Falis
2007-09-29  2:32                           ` Steve
2007-09-29  6:53                             ` Vadim Godunko
2007-09-26 14:08                     ` Dmitry A. Kazakov
2007-09-25  2:39             ` Randy Brukardt
2007-09-25  8:40               ` Michael Bode
2007-09-25 11:28               ` Markus E L
2007-09-26 10:19               ` Pascal Obry
2007-09-26 13:00                 ` Michael Bode
2007-09-25  2:32           ` Randy Brukardt
2007-09-25  8:27             ` Stephen Leake
  -- strict thread matches above, loose matches on Subject: below --
2007-10-12 22:03 Anatoly Chernyshev
2007-10-13 20:25 ` Maciej Sobczak
2007-10-14 10:37   ` Simon Wright
2007-10-14 11:26     ` Markus E L
replies disabled

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