comp.lang.ada
 help / color / mirror / Atom feed
From: Laurent Guerby <guerby@acm.org>
Subject: Re: Ok sorry, it is just a book gives no feedback.
Date: 07 Jan 2001 14:09:11 +0100
Date: 2001-01-07T13:06:45+00:00	[thread overview]
Message-ID: <86snmvv79k.fsf@acm.org> (raw)
In-Reply-To: 937vl0$5gs$1@nnrp1.deja.com

Robert Dewar <robert_dewar@my-deja.com> writes:
>   Laurent Guerby <guerby@acm.org> wrote:
> > The trick is to use pragma Import in Pure units to import
> > "unpure" debugging stuff without withing it.
> 
> Sshhhh! This is a secret trick that should not be revealed to
> the uninitiated :-) :-)

;-)

> Few Ada programmers realize what a huge hole this is in the
> language (introduced in Ada 95 with the formal recognition of
> Ada as a convention).
> 
> You can do all *sorts* of things by using pragma Import and
> Export with convention Ada. You can completely disconnect type
> checking at the subprogram call interface. You can compeltely
> disconnect elaboration order checking in elaboration code etc.
> You can also bypass any "silly" rules that you don't like about
> what you can and cannot WITH.
> 
> I wonder whether we realized what a big hole we were creating
> there. I very seldom favor absolute rules in coding standards,
> so I hesitate to say *never* use convention Ada in this manner,
> but for sure you have to be super careful, it is as bad or
> worse than any of the unchecked interfaces in the language, and
> does not clearly announce itself, since the Import can be
> buried deep in the implementation code.

I think the language designers did not realize this, at least that's
what I infer from reactions when I posted this trick circa 1995 (IIRC)
in comp.lang.ada.

In the "break everything" area you also have stream based code which
does all sorts of "unchecked" stuff without having "unchecked" in its
name (well it's obvious, but it breaks the "grep Unchecked" rule ;-).

Another marginal use of pragma "Import Ada" is to portably disable (I
guess in most implementations ;-) global optimizations. If you want
for example to benchmark a piece of code with inlining on, but don't
want some stuff to be inlined, or to have a smart compiler computing
everything at compile time via global analysis, just "Import Ada" the
given stuff.

-- 
Laurent Guerby <guerby@acm.org>



  reply	other threads:[~2001-01-07 13:09 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-31 14:18 Ok sorry, it is just a book gives no feedback Mark Pagdin
2000-12-31 16:56 ` Robert Dewar
2000-12-31 16:57 ` Robert Dewar
2001-01-01 11:03 ` Tarjei T. Jensen
2001-01-02  9:23 ` Newsgroup cla (was: Ok sorry, it is just a book gives no feedback.) Anders Wirzenius
2001-01-02 10:44   ` Florian Weimer
2001-01-02 13:21     ` Larry Kilgallen
2001-01-02 12:45   ` Andrew Hately
2001-01-02 13:25     ` Florian Weimer
2001-01-02 22:26 ` Ok sorry, it is just a book gives no feedback John English
2001-01-03  6:24 ` Nick Roberts
2001-01-04 13:14   ` Robert Dewar
2001-01-04 15:49     ` n_brunot
2001-01-04 17:09       ` Robert Dewar
2001-01-05  8:53         ` n_brunot
2001-01-05 13:45           ` Robert Dewar
2001-01-05 21:23             ` Randy Brukardt
2001-01-06  4:05               ` Larry Kilgallen
2001-01-06 17:11                 ` Robert Dewar
2001-01-06 20:26                   ` Larry Kilgallen
2001-01-06 22:40                     ` Robert Dewar
2001-01-07  1:12                       ` Larry Kilgallen
2001-01-07  4:19                         ` Robert Dewar
2001-01-07 17:12                           ` Larry Kilgallen
2001-01-08 12:26                             ` Marin David Condic
2001-01-08 12:57                             ` Larry Kilgallen
2001-01-08 15:01                     ` Stephen Leake
2001-01-08 15:58                       ` Ted Dennison
2001-01-09 21:13                       ` Jean-Pierre Rosen
2001-01-06 19:46               ` Laurent Guerby
2001-01-06 20:36                 ` Robert Dewar
2001-01-07 13:09                   ` Laurent Guerby [this message]
2001-01-07 15:56                     ` Robert Dewar
2001-01-07 16:25                       ` Laurent Guerby
2001-01-07 15:58                     ` Robert Dewar
2001-01-07 17:19                     ` Larry Kilgallen
2001-01-06  7:13           ` Simon Wright
2001-01-07 16:00             ` Robert Dewar
2001-01-07 17:16             ` Larry Kilgallen
2001-01-04 17:11       ` Robert Dewar
replies disabled

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