comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@gnat.com
Subject: Re: Adding Things to Package System
Date: 1999/02/18
Date: 1999-02-18T00:00:00+00:00	[thread overview]
Message-ID: <7ai6f5$7hk$1@nnrp1.dejanews.com> (raw)
In-Reply-To: 1999Feb18.192159.18832@nosc.mil

In article <1999Feb18.192159.18832@nosc.mil>,
  claveman@cod.nosc.mil (Charles H. Sampson) wrote:
> I've just come across what looks like an interesting
> bug in both ... compilers.

<<description of effect of adding stuff to System making
  programs illegal>>

ANY addition to System will make some legal programs
illegal, and it is indeed a very bad idea to add stuff
to System.

In GNAT, we use EXACTLY the RM definition of System,
precisely to avoid these nasty kinds of effects.

Now of course we also need compatibility with other Ada
compilers who have (perhaps injudiciously in the past)
added junk to System, notably DEC Ada 83, which adds piles
of stuff.

Our solution to this is the pragma

  pragma Extend_System (package_name);

which takes the given package and merges its declarations
into an extended version of package System. This of course
leads to the kind of problems Charles mentions, but you
only get them if you ask for them.

It is particularly a VERY bad idea to add address
arithmetic operations to System. It causes the serious
kind of problems that Charle's mentions, and I am a little
surprised that other Ada 95 compilers would make this
mistake. Perhaps their users never use USE statements or
even USE TYPE statements :-)

The trouble is that if you add address arithmetic to
System, and do a USE SYSTEM, which even many USE-allergic
folks will tolerate, then the "proper" way of doing address
arithmetic in Ada 95 will not work. This seems a severe
inconvenience to me. Are you sure you are making a correct
analysis of other compilers here?

Robert Dewar
Ada Core Technologies

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




  reply	other threads:[~1999-02-18  0:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-18  0:00 Adding Things to Package System Charles H. Sampson
1999-02-18  0:00 ` dewar [this message]
1999-02-20  0:00   ` Charles H. Sampson
1999-02-20  0:00     ` Matthew Heaney
1999-02-21  0:00     ` dewar
1999-02-23  0:00 ` Tucker Taft
1999-02-26  0:00   ` Charles H. Sampson
1999-02-27  0:00     ` Tucker Taft
1999-02-28  0:00       ` dewar
1999-02-28  0:00     ` 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