comp.lang.ada
 help / color / mirror / Atom feed
From: porton@ex-code.com (Victor Porton)
Subject: Safe "use" directive
Date: Fri, 08 Nov 2002 16:53:15 +0500
Date: 2002-11-08T11:59:18+00:00	[thread overview]
Message-ID: <3dcba716$0$305$bed64819@news.gradwell.net> (raw)

I am willing to follow the following coding standard (in almost all
cases) to improve code safety (I consider it a good coding style for
everybody who uses "use"):

Use "use X" directive for a package X only if the package meets the
following criteria:

The visible part of the package X declares nothing except of subtypes,
(generic) subrountines dependent on types declared in visible part of
X, and also (generic) subpackages (recursively) of X contain only
subtypes dependent on types declared in visible part of X and
subrountines dependent on types declared in visible part of X.

This avoids the danger of initentedly "use"ing a subrountine from
one package working on a type from an other package instead of
assumed the-same-named subrountine from the second package.

Do you agree that it is a good rule? (Don't say: never use "use",
I am only about the case if one uses "use".)

Can the current Ada stylistics checking tools enforce such a rule
without too much effort?

P.S. For packages not following this rule (e.g. some Ada.*), it is
possible to create wrapper packages following the rule.



             reply	other threads:[~2002-11-08 11:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-08 11:53 Victor Porton [this message]
2002-11-08 17:18 ` Safe "use" directive Peter Richtmyer
2002-11-09 10:36 ` Gautier
2002-11-11 14:44 ` Ted Dennison
  -- strict thread matches above, loose matches on Subject: below --
2002-11-12 22:03 Gautier direct_replies_not_read
2002-11-18  1:57 ` Richard Riehle
replies disabled

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