comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: New Ada portable GUI Library?
Date: Sun, 20 Jan 2008 17:38:36 -0500
Date: 2008-01-20T17:38:36-05:00	[thread overview]
Message-ID: <wccy7akxgur.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 4790FDC4.6070106@obry.net

Pascal Obry <pascal@obry.net> writes:

> Robert A Duff a �crit :
>> tmoran@acm.org writes:
>>
>>>    Does that mean the designers of Ada's elaboration got it wrong?
>> Yes.
>
> Hum not sure why!

Well, there are several problems with Ada's elaboration rules.
Perhaps the biggest is that elaboration order is implementation
defined.  You can have a program that works just fine on one
implementation of Ada, but it breaks when you try to port it
to another implementation.  Fixing the problem is a nightmare,
because it's difficult to know where to put the various
pragmas (GNAT can help here!), and circularity messages
are confusing (in every compiler I've tried!), and every
time you add a pragma you have to recompile a whole
lot of stuff.

There are cases where languages should allow implementations to differ:
where there is some efficiency advantage to leaving things ill-defined,
or where there is some legitimate need to access hardware or other
platform-dependent details.  Elaborate order is not such a case!

Another problem is that it's too complicated.  All those pragmas
(Elaborate, Elaborate_All, Preelaborate, Pure, Elaborate_Body,
Preelaborable_Initialization, ... -- did I forget any?).

Another problem is that it's too restrictive.  For example,
you can't say:

    function Make_Symbol(X: String) return Symbol;
    Empty_Symbol: constant Symbol := Make_Symbol("");

in a package visible part, because of the way elaboration works.

Another problem is efficiency: the Ada rules require a run-time check on
every call, and it's hard to optimize away those checks in cases
involving separate compilation.

>... My understanding is that GNAT defaults to something
> stricter and more importantly static, fine. But having a dynamic
> elaboration that let's you handle more complicated cases does not hurt
> to me!

The cases where the GNAT default is too restrictive, but the Ada rule
(i.e. GNAT's -gnatE switch) is not too restrictive, are rare.  I think
I've run into such cases approximately twice in the last 10 years.
And I think they were related to generics (the problem is that
instance bodies are elaborate too early -- it's particularly
annoying when the generic body doesn't do anything, which is
common).

It's a trade-off, but I think the GNAT default improves on the standard
Ada model.  It doesn't solve all the problems, though.

On the other hand, the standard Ada model is better than some languages,
where you can't do anything interesting at elaboration time (so you have
to complicate your interfaces with Initialize procedures).  Or languages
that don't bother to detect cycles at all (you can start using data in a
class if the class initialization has _started_, not necessarily
_finished_).

Self-initializing modules is a Good Idea.  But Ada got some of the
details wrong.

- Bob



  reply	other threads:[~2008-01-20 22:38 UTC|newest]

Thread overview: 93+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-12 13:37 New Ada portable GUI Library? Tomek Walkuski
2008-01-12 15:19 ` Martin Krischik
2008-01-12 18:12   ` Lucretia
2008-01-12 20:40     ` Tomek Walkuski
2008-01-12 23:01       ` Lucretia
2008-01-13  5:17         ` Vadim Godunko
2008-01-13  9:07           ` Lucretia
2008-01-13 10:49             ` Vadim Godunko
2008-01-16  9:45               ` I. Levashew
2008-01-13  8:13         ` Dmitry A. Kazakov
2008-01-13  9:11           ` Lucretia
2008-01-13 10:06             ` Dmitry A. Kazakov
2008-01-13 10:25               ` Tomek Walkuski
2008-01-13 12:36                 ` Dmitry A. Kazakov
2008-01-13 19:58                   ` Michael Bode
2008-01-13 21:00                     ` Dmitry A. Kazakov
2008-01-13 21:53                       ` Michael Bode
2008-01-14  9:11                         ` Dmitry A. Kazakov
2008-01-13 23:08                     ` Gary Scott
2008-01-13 23:31                       ` Michael Bode
2008-01-13 23:50                         ` Gary Scott
2008-01-14 19:12                           ` Michael Bode
2008-01-13 11:27               ` Lucretia
2008-01-13 11:29               ` Lucretia
2008-01-15  7:34               ` Martin Krischik
2008-01-15  8:38                 ` Ludovic Brenta
2008-01-15  8:54                   ` Martin Krischik
2008-02-11 22:10               ` Martin
2008-02-12 18:35                 ` Martin Krischik
2008-02-12 21:43                   ` Tomek Walkuski
2008-01-13 11:14           ` Martin Krischik
2008-01-13 11:31             ` Lucretia
2008-01-14 17:58             ` Ben
2008-01-14 18:21               ` Dmitry A. Kazakov
2008-01-14 20:47                 ` Gautier
2008-01-14 21:32                   ` Dmitry A. Kazakov
2008-01-13 13:28         ` Stephen Leake
2008-01-13 14:14           ` Pascal Obry
2008-01-13 14:22             ` Pascal Obry
2008-01-15  7:54               ` Martin Krischik
2008-01-16  7:54                 ` Brian May
2008-01-16  8:47                   ` Dmitry A. Kazakov
2008-01-16  8:52                   ` Martin Krischik
2008-01-16 18:26                     ` tmoran
2008-01-13 22:22           ` Lucretia
2008-01-14 10:07             ` Stephen Leake
2008-01-12 18:36 ` (slightly OT) Open Source licences? (was: Re: New Ada portable GUI Library?) framefritti
2008-01-12 18:57   ` Maciej Sobczak
2008-01-12 19:27   ` Tomek Walkuski
2008-01-12 19:39   ` (slightly OT) Open Source licences? Gautier
2008-01-12 20:26   ` Dmitry A. Kazakov
2008-01-12 21:58   ` Robert A Duff
2008-01-13  0:04   ` (slightly OT) Open Source licences? (was: Re: New Ada portable GUI Library?) Georg Bauhaus
2008-01-12 22:37 ` Georg Bauhaus
2008-01-13 11:04 ` New Ada portable GUI Library? Gautier
2008-01-15  7:56   ` Martin Krischik
2008-01-15 17:41     ` Gautier
2008-01-16  8:16     ` tmoran
2008-01-16  8:56       ` Martin Krischik
2008-01-16 19:34       ` Gautier
2008-01-16 22:51         ` Randy Brukardt
2008-01-17 20:32           ` Gautier
2008-01-18  1:41             ` Robert A Duff
2008-01-18 17:53               ` tmoran
2008-01-18 18:59                 ` Robert A Duff
2008-01-18 19:28                   ` Pascal Obry
2008-01-20 22:38                     ` Robert A Duff [this message]
2008-01-20  1:38                 ` Jerrid Kimball
2008-01-20 12:30                   ` Ludovic Brenta
2008-01-20 13:40                   ` Stephen Leake
2008-01-20 14:36                     ` Dmitry A. Kazakov
2008-01-15  8:17 ` Martin Krischik
2008-01-15  9:14   ` Ludovic Brenta
2008-01-15 10:39     ` Martin Krischik
2008-01-15 14:01       ` Ludovic Brenta
2008-01-15 16:05         ` Martin Krischik
2008-01-15 17:31           ` Ludovic Brenta
2008-01-16  8:28             ` Martin Krischik
2008-01-17  2:21   ` I. Levashew
2008-01-17  7:34     ` OpenStep/GNUStep/Cocoa (Was: New Ada portable GUI Library?) Martin Krischik
2008-01-17  9:06       ` Ivan Levashew
2008-01-17 10:25         ` Martin Krischik
2008-01-18  3:28           ` Ivan Levashew
2008-01-18  7:24             ` Martin Krischik
2008-01-15 21:51 ` New Ada portable GUI Library? Phaedrus
2008-01-16  0:04   ` Jeffrey R. Carter
2008-01-16  0:20     ` Phaedrus
2008-01-16  1:09       ` Randy Brukardt
2008-01-16  1:47         ` Phaedrus
2008-01-20 14:07 ` Andre
2008-01-21 23:14 ` Frederik Sausmikat
2008-01-27 11:26   ` Lucretia
2008-01-27 16:47     ` Gary Scott
replies disabled

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