comp.lang.ada
 help / color / mirror / Atom feed
* Re: 'with'ing and 'use'ing
  2000-02-29  0:00 'with'ing and 'use'ing Roger Hoyle
@ 2000-02-29  0:00 ` Jeffrey Carter
  2000-02-29  0:00   ` Brian Rogoff
  2000-02-29  0:00 ` David Starner
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 55+ messages in thread
From: Jeffrey Carter @ 2000-02-29  0:00 UTC (permalink / raw)


Roger Hoyle wrote:
> 
> Hi,
> 
> I'm just trying to clear something up in my head.
> 
> I'm trying to interface with a lot [a *lot* :] of Ada95 code and the rest
> of the code has a policy of not 'use'ing other packages, just 'with'ing
> them to force the full names of types & functions etc. As a result, I'm
> adopting the same attitude.
> 
> 1) Is this basically a good idea? It seems sensible to me, but then I know
>    little about Ada. (I'm asking about generally not 'use'ing stuff, not
>    specifically my current situation)

Whether using a package is a good thing depends solely on how easy it is
for someone unfamiliar with the code to read or modify it. Some packages
are designed to be used; see, for example, Ada.Strings.Unbounded. This
package was designed to be used; the type is named Unbounded_String, and
"Unbounded" shows up in many names (Null_Unbounded_String,
To_Unbounded_String). This makes it easy to tell where things came from.

Other packages are so common that it doesn't affect readability to use
them; examples include Ada.Text_IO and
Ada.Numerics.Elementary_Functions. If you see "Put_Line" or "Sqrt" in
your code it's pretty obvious where they come from.

Other packages are not designed to be used, or are designed not to be
used. I tend to write data structure packages so that the code has
declarations such as

   Frequency : Frequency_List.Handle;
   Pending   : Event_Queue.Handle;

These type names would be ambiguous without the dot notation if you used
both packages, and since they both have "Get" operations, the code can
be difficult to read. You probably shouldn't use these packages.

Some people (and organizations) have strict "don't use" policies, while
others use pretty much everything. I advocate pragmatism based on ease
of reading and modifying the code.

Jeff Carter




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-02-29  0:00 ` Robert A Duff
@ 2000-02-29  0:00   ` Ted Dennison
  2000-03-01  0:00   ` Robert Dewar
  1 sibling, 0 replies; 55+ messages in thread
From: Ted Dennison @ 2000-02-29  0:00 UTC (permalink / raw)


In article <wcc900324d1.fsf@world.std.com>,
  Robert A Duff <bobduff@world.std.com> wrote:
> rh@signal.dera.gov.uk (Roger Hoyle) writes:

> The trick is a little bit dangerous, because the code in the Ops
> package is so boring that the reader assumes it says the obvious,
> without reading it carefully.  I remember spending some time tracking
> down a bug caused by saying something like ``function "xor"(...)
> renames "and";'' -- a cut-and-paste error.

I can vouch from personal experience that the *other* Ada83 trick
(renaming the functions) is succeptable to that exact same bug. :-(

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-02-29  0:00 ` Jeffrey Carter
@ 2000-02-29  0:00   ` Brian Rogoff
  2000-03-01  0:00     ` Jean-Pierre Rosen
  0 siblings, 1 reply; 55+ messages in thread
From: Brian Rogoff @ 2000-02-29  0:00 UTC (permalink / raw)


On Tue, 29 Feb 2000, Jeffrey Carter wrote:
> Roger Hoyle wrote:
> > 
> > Hi,
> > 
> > I'm just trying to clear something up in my head.
> > 
> > I'm trying to interface with a lot [a *lot* :] of Ada95 code and the rest
> > of the code has a policy of not 'use'ing other packages, just 'with'ing
> > them to force the full names of types & functions etc. As a result, I'm
> > adopting the same attitude.
> > 
> > 1) Is this basically a good idea? It seems sensible to me, but then I know
> >    little about Ada. (I'm asking about generally not 'use'ing stuff, not
> >    specifically my current situation)
> 
> Whether using a package is a good thing depends solely on how easy it is
> for someone unfamiliar with the code to read or modify it. Some packages
> are designed to be used; see, for example, Ada.Strings.Unbounded. This
> package was designed to be used; the type is named Unbounded_String, and
> "Unbounded" shows up in many names (Null_Unbounded_String,
> To_Unbounded_String). This makes it easy to tell where things came from.
> 
> Other packages are so common that it doesn't affect readability to use
> them; examples include Ada.Text_IO and
> Ada.Numerics.Elementary_Functions. If you see "Put_Line" or "Sqrt" in
> your code it's pretty obvious where they come from.
> 
> Other packages are not designed to be used, or are designed not to be
> used. I tend to write data structure packages so that the code has
> declarations such as
> 
>    Frequency : Frequency_List.Handle;
>    Pending   : Event_Queue.Handle;

I use a very similar style when now myself, with the main type exported
from a package getting the name "T" and helper types getting names like 
"Index_T". One of the things that motivated me to try that style was a 
deliberate attempt to program without use clauses. 

I use use clauses but I thought it would be a good exercise to try and
program without them. 

> These type names would be ambiguous without the dot notation if you used
> both packages, and since they both have "Get" operations, the code can
> be difficult to read. You probably shouldn't use these packages.
> 
> Some people (and organizations) have strict "don't use" policies, while
> others use pretty much everything. I advocate pragmatism based on ease
> of reading and modifying the code.

I agree completely with this sentiment, and the rest of the post. Draconian 
rules like "never use use clauses, goto, exceptions for control flow, ATC,
subprogram nesting, etc" seem silly to me. Understand the motivations for
the proposed restrictions, and decide for yourself based on the situation.

-- Brian





^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-02-29  0:00   ` Jeffrey Carter
@ 2000-02-29  0:00     ` xl
  0 siblings, 0 replies; 55+ messages in thread
From: xl @ 2000-02-29  0:00 UTC (permalink / raw)


Sorry... Operat'ors'.

Jeffrey Carter wrote:
> 
> xl@home.com wrote:
> >
> > Actually, the idea of not "Use"ing packages is quite common.  But you
> > are right, the effect of not pulling in the operators for defined types
> > can get a bit irritating.  My project saw this early on and allows the
> > use of the "use type xxxx;" statement to circumvent the need for the
> > functional notation use of operators such as ">=" etc...  The 'use type'
> > statement has the effect of providing visibility to all operations on
> > the type specified without haveing to resort to a general use clause on
> > the entire package surrounding the type in question.  Quite handy and
> > much more readable.
> 
> This is incorrect: "use type" does not provide visibility to "all
> operations". Use type provides visibility to operators; operations that
> are not operators still require dot notation.
> 
> Jeff Carter




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-02-29  0:00 'with'ing and 'use'ing Roger Hoyle
  2000-02-29  0:00 ` Jeffrey Carter
@ 2000-02-29  0:00 ` David Starner
  2000-02-29  0:00 ` Robert A Duff
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 55+ messages in thread
From: David Starner @ 2000-02-29  0:00 UTC (permalink / raw)


On 29 Feb 2000 17:46:54 +0000, Roger Hoyle <rh@signal.dera.gov.uk> wrote:
>2) One of the packages defines a sub-package called Ops, which contains
>   the operators (=,/=,>=,<=) etc for some of the types in the main
>   package. The only way I seem to be able to get access to these operators
>   is to 'use' the package. Is this right, or am I missing somehting?

I'm surprised no one has mentioned it, but you can always call them
as Foo."="(a, b) without needing any form of use. I would recommend
"use type" instead, though, since you aren't bound from above. =
is a lot more elegant than Foo."=", and rarely makes it less readable.
(Of course, I probably overuse just plain "use"s, so take that with
a grain of salt.)

-- 
David Starner - dstarner98@aasaa.ofe.org
Only a nerd would worry about wrong parentheses with
square brackets. But that's what mathematicians are.
   -- Dr. Burchard, math professor at OSU




^ permalink raw reply	[flat|nested] 55+ messages in thread

* 'with'ing and 'use'ing
@ 2000-02-29  0:00 Roger Hoyle
  2000-02-29  0:00 ` Jeffrey Carter
                   ` (4 more replies)
  0 siblings, 5 replies; 55+ messages in thread
From: Roger Hoyle @ 2000-02-29  0:00 UTC (permalink / raw)


Hi,

I'm just trying to clear something up in my head.

I'm trying to interface with a lot [a *lot* :] of Ada95 code and the rest
of the code has a policy of not 'use'ing other packages, just 'with'ing
them to force the full names of types & functions etc. As a result, I'm
adopting the same attitude.

1) Is this basically a good idea? It seems sensible to me, but then I know
   little about Ada. (I'm asking about generally not 'use'ing stuff, not
   specifically my current situation)

2) One of the packages defines a sub-package called Ops, which contains
   the operators (=,/=,>=,<=) etc for some of the types in the main
   package. The only way I seem to be able to get access to these operators
   is to 'use' the package. Is this right, or am I missing somehting?

Any help gratefully received.

Thanks

rog.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-02-29  0:00 'with'ing and 'use'ing Roger Hoyle
                   ` (2 preceding siblings ...)
  2000-02-29  0:00 ` Robert A Duff
@ 2000-02-29  0:00 ` xl
  2000-02-29  0:00   ` Jeffrey Carter
  2000-03-01  0:00   ` Roger Hoyle
  2000-02-29  0:00 ` Ted Dennison
  4 siblings, 2 replies; 55+ messages in thread
From: xl @ 2000-02-29  0:00 UTC (permalink / raw)


Actually, the idea of not "Use"ing packages is quite common.  But you
are right, the effect of not pulling in the operators for defined types
can get a bit irritating.  My project saw this early on and allows the
use of the "use type xxxx;" statement to circumvent the need for the
functional notation use of operators such as ">=" etc...  The 'use type'
statement has the effect of providing visibility to all operations on
the type specified without haveing to resort to a general use clause on
the entire package surrounding the type in question.  Quite handy and
much more readable.

Robert

Roger Hoyle wrote:
> 
> Hi,
> 
> I'm just trying to clear something up in my head.
> 
> I'm trying to interface with a lot [a *lot* :] of Ada95 code and the rest
> of the code has a policy of not 'use'ing other packages, just 'with'ing
> them to force the full names of types & functions etc. As a result, I'm
> adopting the same attitude.
> 
> 1) Is this basically a good idea? It seems sensible to me, but then I know
>    little about Ada. (I'm asking about generally not 'use'ing stuff, not
>    specifically my current situation)
> 
> 2) One of the packages defines a sub-package called Ops, which contains
>    the operators (=,/=,>=,<=) etc for some of the types in the main
>    package. The only way I seem to be able to get access to these operators
>    is to 'use' the package. Is this right, or am I missing somehting?
> 
> Any help gratefully received.
> 
> Thanks
> 
> rog.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-02-29  0:00 'with'ing and 'use'ing Roger Hoyle
                   ` (3 preceding siblings ...)
  2000-02-29  0:00 ` xl
@ 2000-02-29  0:00 ` Ted Dennison
  2000-03-01  0:00   ` Robert Dewar
  4 siblings, 1 reply; 55+ messages in thread
From: Ted Dennison @ 2000-02-29  0:00 UTC (permalink / raw)


In article <yoxzosjx5o1.fsf@dymock.dra.hmg.gb>,
  rh@signal.dera.gov.uk (Roger Hoyle) wrote:

> of the code has a policy of not 'use'ing other packages, just
> 'with'ing them to force the full names of types & functions etc. As a
> result, I'm adopting the same attitude.
>
> 1) Is this basically a good idea? It seems sensible to me, but then I
>    know little about Ada. (I'm asking about generally not 'use'ing
>    stuff, not specifically my current situation)

That's a very contraversial issue (odds are, you've just unwittingly
touched off another flamewar about it). Suffice it to say that many
people (myself included) think that's the "right" way to do things. Many
other people whose opinions I respect feel that's hogwash.

The basic issue is how easy it is for a new reader (such as yourself) to
figure out where routines and objects are declared. If you have source
code analysis tools available that can easily find declarations in other
source files for you whenever you need to know, then there's a good
argument that "use"s are OK. If you have some routines for which it is
obvious to any competent reader where the declarations are, then it
could be argued that "use"s are OK.

> 2) One of the packages defines a sub-package called Ops, which
>    contains the operators (=,/=,>=,<=) etc for some of the types in
>    the main package. The only way I seem to be able to get access to
>    these operators is to 'use' the package. Is this right, or am I
>     missing somehting?

That's one of 2 idioms that were commonly used in Ada83 to gain
visibility to operators. The other was to do a function rename for them
somewhere in the scope you wanted to use them.

In Ada 95 you don't really need to do either anymore. There is a "use
type" clause that serves this purpose. Unlike the normal "use" clause,
"use type" is not very contraversial.

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-02-29  0:00 'with'ing and 'use'ing Roger Hoyle
  2000-02-29  0:00 ` Jeffrey Carter
  2000-02-29  0:00 ` David Starner
@ 2000-02-29  0:00 ` Robert A Duff
  2000-02-29  0:00   ` Ted Dennison
  2000-03-01  0:00   ` Robert Dewar
  2000-02-29  0:00 ` xl
  2000-02-29  0:00 ` Ted Dennison
  4 siblings, 2 replies; 55+ messages in thread
From: Robert A Duff @ 2000-02-29  0:00 UTC (permalink / raw)


rh@signal.dera.gov.uk (Roger Hoyle) writes:

> 1) Is this basically a good idea? It seems sensible to me, but then I know
>    little about Ada. (I'm asking about generally not 'use'ing stuff, not
>    specifically my current situation)

You've just started a language war between the two dialects of Ada --
the use-phobes and the use-philes.  ;-)

And then there's the folks who advocate renaming all packages as
incomprehensible abbreviations, so you can say XQYBC.Grind_Upon_List.  ;-)

I slightly prefer using use clauses.

Of course, you don't have much choice -- the existing code doesn't use
use, so presumably the names were chosen with that in mind.

>    the operators (=,/=,>=,<=) etc for some of the types in the main
>    package. The only way I seem to be able to get access to these operators
>    is to 'use' the package. Is this right, or am I missing somehting?

This is a trick used in Ada 83 to avoid use-visibility for identifiers,
but still allow the operators to be directly visible.  (While saying
``Foo.Bar(X, Y)'' might be reasonable, saying ``Foo."+"(X, Y)'' is an
abomination.)  Yes, you need to say "use Whatever.Ops;" for this trick
to work.  The trick is no longer needed in Ada 95 -- use "use type"
instead.

The trick is a little bit dangerous, because the code in the Ops package
is so boring that the reader assumes it says the obvious, without
reading it carefully.  I remember spending some time tracking down a bug
caused by saying something like ``function "xor"(...) renames "and";''
-- a cut-and-paste error.

- Bob




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-02-29  0:00 ` xl
@ 2000-02-29  0:00   ` Jeffrey Carter
  2000-02-29  0:00     ` xl
  2000-03-01  0:00   ` Roger Hoyle
  1 sibling, 1 reply; 55+ messages in thread
From: Jeffrey Carter @ 2000-02-29  0:00 UTC (permalink / raw)


xl@home.com wrote:
> 
> Actually, the idea of not "Use"ing packages is quite common.  But you
> are right, the effect of not pulling in the operators for defined types
> can get a bit irritating.  My project saw this early on and allows the
> use of the "use type xxxx;" statement to circumvent the need for the
> functional notation use of operators such as ">=" etc...  The 'use type'
> statement has the effect of providing visibility to all operations on
> the type specified without haveing to resort to a general use clause on
> the entire package surrounding the type in question.  Quite handy and
> much more readable.

This is incorrect: "use type" does not provide visibility to "all
operations". Use type provides visibility to operators; operations that
are not operators still require dot notation.

Jeff Carter




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-01  0:00         ` Ted Dennison
@ 2000-03-01  0:00           ` Wes Groleau
  2000-03-02  0:00             ` Robert Dewar
  0 siblings, 1 reply; 55+ messages in thread
From: Wes Groleau @ 2000-03-01  0:00 UTC (permalink / raw)


> [Ada.Strings.Unbounded.Unbounded_String is] actually exhibit A 
> for the kind of thing I'm complaining about. How
> do the authors of that package know that I have a system where its
> appropriate to perform "use"s? 

Or why do they assume you don't work in a shop that 
labels "use" a mortal sin?

These shops exist, and though I disagree with their
attitude, I think it was inappropriate for the 9X designers
to force them to choose between their religion 
and readability.

(Or to force employees of such a shop to choose between
the boss's rules and readability.)

Revision suggestion (yes, I know this is the wrong address): 
We're stuck with these redundant names, since some are already 
in use.  But next revision, packages like unbounded could, via
'renames,' provide alternate names that won't look stupid 
in an anti-use shop.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-02-29  0:00 ` xl
  2000-02-29  0:00   ` Jeffrey Carter
@ 2000-03-01  0:00   ` Roger Hoyle
  1 sibling, 0 replies; 55+ messages in thread
From: Roger Hoyle @ 2000-03-01  0:00 UTC (permalink / raw)



>                            My project saw this early on and allows the
> use of the "use type xxxx;" statement to circumvent the need for the
> functional notation use of operators such as ">=" etc...  The 'use type'
> statement has the effect of providing visibility to all operations on
> the type specified without haveing to resort to a general use clause on
> the entire package surrounding the type in question.  Quite handy and
> much more readable.

Oooh, that works a treat.

Thanks a lot.

cheers

rog.

(currently a happy rabbit)




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-02-29  0:00 ` Ted Dennison
@ 2000-03-01  0:00   ` Robert Dewar
  2000-03-01  0:00     ` Ted Dennison
  0 siblings, 1 reply; 55+ messages in thread
From: Robert Dewar @ 2000-03-01  0:00 UTC (permalink / raw)


In article <89h5lh$70r$1@nnrp1.deja.com>,
  Ted Dennison <dennison@telepath.com> wrote:
> That's a very contraversial issue (odds are, you've just
unwittingly
> touched off another flamewar about it). Suffice it to say that
many
> people (myself included) think that's the "right" way to do
things. Many
> other people whose opinions I respect feel that's hogwash.


So, when you are using existing packages that are already
existing, the choice of whether to use USE or not is often
dictated by the naming conventions of that package. When you
design a package, you choose names that are designed either
with the idea of USE in mind or not.

It is really quite irritating to see a package that was
carefully designed to be used with USE adopted into a program
which blindly follows the no-USE policy, and end up with noise
like:

   Angle_Handling.Angle_Handling_Options := True;

As always, blind rules are just that, blind :-)

Whether it is a good idea or not to avoid USE depends on many
things, but the basic design point of view is to make things
easier for the reader. This may partially depend on the
environment. For example, if the readers have to suffer in
an environment (they still exist :-( today) where there is
no simple way to click on a name to immediately find out what
package it is defined in, then putting dots all over the place
may have some advantage in some cases for readers.

What some people like to do is to use local abbreviations

  package MCA renames Major_Complex_Arithmetic;

and then use MCA.xxx in the client. This to me seems the worst
of both worlds, because now even a complete familiarity with
the package is not enough to guess what is going on. If you
must follow this approach, please standardize the abbreviations
to be used and document them in the package itself, so that
all clients use the same abbreviation.

Indeed if everyone everywhere will use MCA as the "name" of
this package, perhaps you should define a library level
renaming of the package and with that, or even change the
name of the package to MCA.

My own taste is for a flexible approach. Use USE where it is
helpful to do so, don't use it otherwise, don't have fixed
rules (which are seldom a good substitute for judgment).

The policy in the GNAT sources is to use USE in the compiler
itself, it makes the code a lot clearer once you get to know
the basic structure of the sources, since in 99% of the cases
you immediately know where something is. For example, even a
surface familiarity of the GNAT sources will tell you that

  Expand_N_Goto_Statement;

must be in the package Exp_Ch5, since it is obviously an
expansion activity, and we know goto's are a statement form
defined in chapter 5. Furthermore, we assume that typically
if you are working with the GNAT sources, you have reasonable
locating tools available (such as are supplied with GNAT).

For the run-time library, we mostly avoid the use of USE, since
these sources are used in all kinds of contexts, and typically
and frequently examined by people not very familiar with the
library.

It is relatively unusual (did any user ever do it?) to dip into
the GNAT front end sources to answer a question about GNAT. It
is quite common to dip into the runtime for this purpose.

Robert Dewar
Ada Core Technologies


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-02-29  0:00 ` Robert A Duff
  2000-02-29  0:00   ` Ted Dennison
@ 2000-03-01  0:00   ` Robert Dewar
  1 sibling, 0 replies; 55+ messages in thread
From: Robert Dewar @ 2000-03-01  0:00 UTC (permalink / raw)


In article <wcc900324d1.fsf@world.std.com>,
  Robert A Duff <bobduff@world.std.com> wrote:
> rh@signal.dera.gov.uk (Roger Hoyle) writes:
>
> > 1) Is this basically a good idea? It seems sensible to me,
but then I know
> >    little about Ada. (I'm asking about generally not
'use'ing stuff, not
> >    specifically my current situation)
>
> You've just started a language war between the two dialects of
Ada --
> the use-phobes and the use-philes.  ;-)

That's not quite right, because the situation is not
symmetrical.

The use-phobes are indeed phobic, and actually subset the
language, often working in a subset that forbids USE clauses
completely.

The class of people who Bob calls use-philes are no more
use-philes than they are procedure-files or
assignment-statement-philes. It is not that they *like*
USE clauses, they simply regard them, like any other
feature in the language, as something to be used when
appropriate and not otherwise.



Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-01  0:00   ` Robert Dewar
@ 2000-03-01  0:00     ` Ted Dennison
  2000-03-01  0:00       ` Robert Dewar
  0 siblings, 1 reply; 55+ messages in thread
From: Ted Dennison @ 2000-03-01  0:00 UTC (permalink / raw)


In article <89j5h5$j0j$1@nnrp1.deja.com>,
  Robert Dewar <dewar@gnat.com> wrote:
> In article <89h5lh$70r$1@nnrp1.deja.com>,
> It is really quite irritating to see a package that was
> carefully designed to be used with USE adopted into a program
> which blindly follows the no-USE policy, and end up with noise
> like:
>
>    Angle_Handling.Angle_Handling_Options := True;

As someone who would probably end up writing the above, this is a
statement I can agree whole-heartedly with. There are legitimate
examples where object names in a package can be well-designed to support
use's. In fact I saw a very good example of that in another followup of
yours. But this is not one of them. You can't possibly argue that

   Angle_Handling_Options := True;

is easier to understand than

   Angle_Handling.Options := True;

which is how it could have been named. The only difference is a single
character, and the first contains *less* information for the reader.

I just don't see what good is gained by taking this kind of naming
approach. Its as if the author was thinking: "People may do a "use",
obfuscating the origin of this object. So I'll partially thwart them by
tacking the package name to the front of the object again". Never mind
that the users of this package will now be forced to type the stupidly
redundant statement at the top, or to perform a "use" clause regardless
of whether it is appropriate in their environment.

I wouldn't bother to drag the thread off on this tangent, except that
this brand of user-callousness is rife in the Ada.* packages, and it is,
as you say, quite irritating. Worse yet is the thought that some people
may take up this style for their own general-purpose Ada packages.

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-01  0:00     ` Ted Dennison
@ 2000-03-01  0:00       ` Robert Dewar
  2000-03-01  0:00         ` Ted Dennison
  0 siblings, 1 reply; 55+ messages in thread
From: Robert Dewar @ 2000-03-01  0:00 UTC (permalink / raw)


In article <89jdfu$ok4$1@nnrp1.deja.com>,
  Ted Dennison <dennison@telepath.com> wrote:
> But this is not one of them. You can't possibly argue that
>
>    Angle_Handling_Options := True;
>
> is easier to understand than
>
>    Angle_Handling.Options := True;
>
> which is how it could have been named.

I don't! But equally arguing that the second is easier to
understand than the first is also a heavy bruden. They
are really pretty much equivalent in the environment where
you know that Angle_Handling options is a package, and
either is preferable in my view to

 ANHN.Options := True;

What happens is in practice is that you use compound names
some of the time but not all. Unbounded strings in Annex A
is a perfect example of the kind of naming I think is quite
appropriate for a package intended to be used (as someone
else pointed out on this list).


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-01  0:00       ` Robert Dewar
@ 2000-03-01  0:00         ` Ted Dennison
  2000-03-01  0:00           ` Wes Groleau
  0 siblings, 1 reply; 55+ messages in thread
From: Ted Dennison @ 2000-03-01  0:00 UTC (permalink / raw)


In article <89jk9g$u3b$1@nnrp1.deja.com>,
  Robert Dewar <robert_dewar@my-deja.com> wrote:
> In article <89jdfu$ok4$1@nnrp1.deja.com>,

> I don't! But equally arguing that the second is easier to
> understand than the first is also a heavy bruden. They
> are really pretty much equivalent in the environment where
> you know that Angle_Handling options is a package, and

Well, there *is* the extra information in the second. But I'll give you
the point with your caveat included. The big problem is when this is
done for a general-purpose package, where the author has no prior
knowledge that it will be used in such an environment.


> either is preferable in my view to
>  ANHN.Options := True;

I have to agree completely with that one. However, I've only seen that
happen very rarely, and always by a Fortran refugee who's used to
working with names like this.

I'd personally consider that a completely separate third style that is
used mainly by less skilled engineers who don't know any better.

> some of the time but not all. Unbounded strings in Annex A
> is a perfect example of the kind of naming I think is quite
> appropriate for a package intended to be used (as someone
> else pointed out on this list).

Its actually exhibit A for the kind of thing I'm complaining about. How
do the authors of that package know that I have a system where its
appropriate to perform "use"s? They don't. But nevertheless they wrote
it such that my only choice is to do a "use" or write stupid-looking
redundant code.

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-02-29  0:00   ` Brian Rogoff
@ 2000-03-01  0:00     ` Jean-Pierre Rosen
  2000-03-02  0:00       ` Charles Hixson
  2000-03-03  0:00       ` Charles H. Sampson
  0 siblings, 2 replies; 55+ messages in thread
From: Jean-Pierre Rosen @ 2000-03-01  0:00 UTC (permalink / raw)


As a known use-phile, I can't resist adding my 0.02 Euros...

Two issues:
1) Do not confuse using full names and forbidding use clauses. It is
perfectly possible to write full names while in the scope of a use clause
for a package. Sometimes, I use full names although I'm in scope simply
because I find that, for a particular name, I need a more accurate
description. Having a use clause leaves me the choice of the way I write it
on a case-by-case basis.

2) Use-phobes often consider only global "use", i.e. immediately following
the "with". The use clause is actually intended to open visibility only
where needed. My own preferred style is to put a use clause immediately
after the header of the innermost program unit that needs it *including when
the whole compilation unit needs it*, i.e. never after the with. For
example:

with Complex_Numbers, Text_IO;
package body Pack is
   use Complex_Numbers;  -- used everywhere in the package
   ...
   procedure Put (X : Some_Type) is
       use Text_IO;   -- Text_IO used only in this procedure
       ...
   end Put;
end Pack;

This really brings extra information, because you know precisely where each
package is actually used.

--
---------------------------------------------------------
           J-P. Rosen (Rosen.Adalog@wanadoo.fr)
Visit Adalog's web site at http://pro.wanadoo.fr/adalog






^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-01  0:00           ` Wes Groleau
@ 2000-03-02  0:00             ` Robert Dewar
  0 siblings, 0 replies; 55+ messages in thread
From: Robert Dewar @ 2000-03-02  0:00 UTC (permalink / raw)


In article <38BD80CD.4462065@ftw.rsc.raytheon.com>,
  Wes Groleau <wwgrol@ftw.rsc.raytheon.com> wrote:
> > [Ada.Strings.Unbounded.Unbounded_String is] actually exhibit
A
> > for the kind of thing I'm complaining about. How
> > do the authors of that package know that I have a system
where its
> > appropriate to perform "use"s?
>
> Or why do they assume you don't work in a shop that
> labels "use" a mortal sin?
>
> These shops exist, and though I disagree with their
> attitude, I think it was inappropriate for the 9X designers
> to force them to choose between their religion
> and readability.
>
> (Or to force employees of such a shop to choose between
> the boss's rules and readability.)
>
> Revision suggestion (yes, I know this is the wrong address):
> We're stuck with these redundant names, since some are already
> in use.  But next revision, packages like unbounded could, via
> 'renames,' provide alternate names that won't look stupid
> in an anti-use shop.


The design of the Ada language assumes that you use the entire
language. If you choose to subset the language, some adjustments
may need to be made, but since3 you chose to do the
subsetting, it is up to you to undo the damage, if any,
caused by that.

If you have banned use clauses, then yes, the otherwise nicely
chosen names in Ada.Strings.Unbounded will be annoying, so it
is up to you provide a package with renamings that match your
particular restrictive usage and rules.

It is unreasonable to ask that the RM anticipate all such
ill-advised subsetting rules, and somehow compensate for
them in advance.


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-01  0:00     ` Jean-Pierre Rosen
@ 2000-03-02  0:00       ` Charles Hixson
  2000-03-02  0:00         ` Robert A Duff
  2000-03-03  0:00       ` Charles H. Sampson
  1 sibling, 1 reply; 55+ messages in thread
From: Charles Hixson @ 2000-03-02  0:00 UTC (permalink / raw)


Jean-Pierre Rosen wrote:

> As a known use-phile, I can't resist adding my 0.02 Euros...
>
> Two issues:
> 1) Do not confuse using full names and forbidding use clauses. It is
> perfectly possible to write full names while in the scope of a use clause
> for a package. Sometimes, I use full names although I'm in scope simply
> because I find that, for a particular name, I need a more accurate
> description. Having a use clause leaves me the choice of the way I write it
> on a case-by-case basis.

 -- snip
A nice technique here is to use the full name the first time that the name is
referenced.  This informs the browser of where the name is to be found.
Subsequent uses can then abbreviate the notation to just the name.  The use
clause allows the compiler to do this, and the first fully named use allows the
reader to understand it in context.






^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-02  0:00       ` Charles Hixson
@ 2000-03-02  0:00         ` Robert A Duff
  2000-03-02  0:00           ` Ted Dennison
  0 siblings, 1 reply; 55+ messages in thread
From: Robert A Duff @ 2000-03-02  0:00 UTC (permalink / raw)


Charles Hixson <charleshixsn@earthlink.net> writes:

> A nice technique here is to use the full name the first time that the name is
> referenced.  This informs the browser of where the name is to be found.
> Subsequent uses can then abbreviate the notation to just the name.  The use
> clause allows the compiler to do this, and the first fully named use allows the
> reader to understand it in context.


Hmm.  I don't think I like that idea.  If I saw:

    Some_Package.Grind_Upon_Data(...);
    ...
    Grind_Upon_Data(...);

I would tend to think there must be two different (overloaded) things
called Grind_Upon_Data.

- Bob




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-02  0:00         ` Robert A Duff
@ 2000-03-02  0:00           ` Ted Dennison
  2000-03-02  0:00             ` Charles Hixson
  0 siblings, 1 reply; 55+ messages in thread
From: Ted Dennison @ 2000-03-02  0:00 UTC (permalink / raw)


In article <wccputd8aqx.fsf@world.std.com>,
  Robert A Duff <bobduff@world.std.com> wrote:
> Charles Hixson <charleshixsn@earthlink.net> writes:
>
> > A nice technique here is to use the full name the first time that
> > the name is referenced.  This informs the browser of where the name
> > is to be found.

> Hmm.  I don't think I like that idea.  If I saw:
(example deleted)
> I would tend to think there must be two different (overloaded) things

I don't think it would be helpful in my typical circumstance, where I am
looking at a particular malfunctioning routine in someone else's code
either. The odds of me seeing the "first reference" first are not good.

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-02  0:00           ` Ted Dennison
@ 2000-03-02  0:00             ` Charles Hixson
  2000-03-02  0:00               ` David Starner
                                 ` (3 more replies)
  0 siblings, 4 replies; 55+ messages in thread
From: Charles Hixson @ 2000-03-02  0:00 UTC (permalink / raw)


I was actually thinking of in my own code (so I could answer the question
"Now where did I get that from?").  I suppose that this should be commented,
so that I'll later remember that it was used (in which case I could stick
the label in the comment).

A good cross-reference tool would be better, but I haven't seen one
recently.  (Probably because programs/libraries have gotten too voluminous
for them to handle properly.)  I suppose what's really needed is something
like a smarter version of JavaDoc.  Of course an integrated tool like
genitor would be nice, but it needs to be tuned to one language (C++ of
course) and is a trifle too expensive for my pocket-book (which runs more to
the Source-Navigator level [again tied to C++]).

The trouble is that any tool that can tell enough to figure out where a link
comes from, needs enough built in knowledge to be pretty expensive to build,
so unless AdaCore starts including it in the GNAT package, I'm unlikely to
be able to afford it (which is why the tools I *am* aware of target C++).






^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-02  0:00             ` Charles Hixson
@ 2000-03-02  0:00               ` David Starner
  2000-03-03  0:00                 ` Ted Dennison
  2000-03-03  0:00                 ` Jeff Carter
  2000-03-03  0:00               ` Larry Kilgallen
                                 ` (2 subsequent siblings)
  3 siblings, 2 replies; 55+ messages in thread
From: David Starner @ 2000-03-02  0:00 UTC (permalink / raw)


On Thu, 02 Mar 2000 22:57:09 GMT, Charles Hixson <charleshixsn@earthlink.net> wrote:
>The trouble is that any tool that can tell enough to figure out where a link
>comes from, needs enough built in knowledge to be pretty expensive to build,

Actually, no. If I understand the ASIS stuff, it makes it possible to write
stuff like that without a complete Ada parser. Cf. gnatelim and gch.

>so unless AdaCore starts including it in the GNAT package, I'm unlikely to
>be able to afford it (which is why the tools I *am* aware of target C++).

Ada mode for emacs (distributed by AdaCore) does do this, using gnatfind.
Personally, I would prefer a lean mean code editor where it's easy to
find the options you need, but ada-mode w/ xemacs is a decent "intellegent"
editor for Ada.

-- 
David Starner - dstarner98@aasaa.ofe.org
Only a nerd would worry about wrong parentheses with
square brackets. But that's what mathematicians are.
   -- Dr. Burchard, math professor at OSU




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-01  0:00     ` Jean-Pierre Rosen
  2000-03-02  0:00       ` Charles Hixson
@ 2000-03-03  0:00       ` Charles H. Sampson
  2000-03-04  0:00         ` Jean-Pierre Rosen
  2000-03-06  0:00         ` Ted Dennison
  1 sibling, 2 replies; 55+ messages in thread
From: Charles H. Sampson @ 2000-03-03  0:00 UTC (permalink / raw)


     M. Rosen modestly omits that he wrote a very good paper several 
years ago arguing in favor of the use clause.  While I was already a 
strong use-phile before reading the paper, it clarified a number of 
ideas that I had understood only instinctively.  I haven't read it in 
several years but I remember the argument that fully-qualified names in-
hibit readability because the least important part of the name is on the
left, (the most significant position) and the most important part is on
the right (the least significant position).  A common argument against 
the use clause is that fully-qualified names make it easy to find an 
identifier's declaration when necessary.  M. Rosen argued that this 
wouldn't be necessary when we had environments that led us from use to 
declaration with a mouse click.  We have such environments now. 

     I've always characterized this latter argument against the use 
clause as being akin to writing a paper with each word followed by the 
page number where its definition could be found in a certain dictionary,
just in case somebody needs to know.  Not the world's greatest analogy 
but, in other words, to me it's been a lot of clutter to carry around 
for the occasional use.

     I can't remember where to find the paper, even though I'm sure I 
have one lost in the mass of papers in my office.  I think it was pub-
lished in Ada Letters.  I've poked around adahome for a few minutes and
couldn't find it there.  J-P?

                                Charlie


-- 
     To get my correct email address, replace the "claveman" by
"csampson" in my fake (anti-spam) address.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-02  0:00               ` David Starner
  2000-03-03  0:00                 ` Ted Dennison
@ 2000-03-03  0:00                 ` Jeff Carter
  2000-03-03  0:00                   ` David Starner
  1 sibling, 1 reply; 55+ messages in thread
From: Jeff Carter @ 2000-03-03  0:00 UTC (permalink / raw)


David Starner wrote:
[referring to find-declaration tools]
> Ada mode for emacs (distributed by AdaCore) does do this, using gnatfind.
> Personally, I would prefer a lean mean code editor where it's easy to
> find the options you need, but ada-mode w/ xemacs is a decent "intellegent"
> editor for Ada.

AdaGIDE, distributed by ACT with the Windows version of GNAT, has this
feature, too.

-- 
Jeff Carter
"I unclog my nose towards you."
Monty Python & the Holy Grail




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-03  0:00                 ` Jeff Carter
@ 2000-03-03  0:00                   ` David Starner
  2000-03-04  0:00                     ` Simon Wright
  0 siblings, 1 reply; 55+ messages in thread
From: David Starner @ 2000-03-03  0:00 UTC (permalink / raw)


On Fri, 03 Mar 2000 01:25:51 GMT, Jeff Carter <jrcarter@acm.org> wrote:
>David Starner wrote:
>[referring to find-declaration tools]
>> Ada mode for emacs (distributed by AdaCore) does do this, using gnatfind.
>> Personally, I would prefer a lean mean code editor where it's easy to
>> find the options you need, but ada-mode w/ xemacs is a decent "intellegent"
>> editor for Ada.
>
>AdaGIDE, distributed by ACT with the Windows version of GNAT, has this
>feature, too.

Not currently much use for us Un*x fans. It would be nice to have something
like this for X, but I don't currently have the time to port it.

-- 
David Starner - dstarner98@aasaa.ofe.org
Only a nerd would worry about wrong parentheses with
square brackets. But that's what mathematicians are.
   -- Dr. Burchard, math professor at OSU




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-02  0:00             ` Charles Hixson
  2000-03-02  0:00               ` David Starner
@ 2000-03-03  0:00               ` Larry Kilgallen
  2000-03-03  0:00               ` Marin D. Condic
  2000-03-04  0:00               ` Robert Dewar
  3 siblings, 0 replies; 55+ messages in thread
From: Larry Kilgallen @ 2000-03-03  0:00 UTC (permalink / raw)


In article <38BEF1A3.24B566BF@earthlink.net>, Charles Hixson <charleshixsn@earthlink.net> writes:
> I was actually thinking of in my own code (so I could answer the question
> "Now where did I get that from?").  I suppose that this should be commented,
> so that I'll later remember that it was used (in which case I could stick
> the label in the comment).

A coding style understood by all who will see the source seems good.
However, I have some Ada source I wrote 12 years ago over which I
have had sole custody, and when I go back to maintain it I am a bit
tempted to ask (myself) "Who wrote that, and why did they do it that
way ?".




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-02  0:00               ` David Starner
@ 2000-03-03  0:00                 ` Ted Dennison
  2000-03-07  0:00                   ` Nick Roberts
  2000-03-03  0:00                 ` Jeff Carter
  1 sibling, 1 reply; 55+ messages in thread
From: Ted Dennison @ 2000-03-03  0:00 UTC (permalink / raw)


In article <89ms0a$aik1@news.cis.okstate.edu>,
  dstarner98@aasaa.ofe.org wrote:
> On Thu, 02 Mar 2000 22:57:09 GMT, Charles Hixson

> Ada mode for emacs (distributed by AdaCore) does do this, using
> gnatfind. Personally, I would prefer a lean mean code editor where
> it's easy to find the options you need, but ada-mode w/ xemacs is a
> decent "intellegent" editor for Ada.

That doesn't help at all in the (rather common) occurance where I'm
called over to help another engineer figure out why their program isn't
compiling. If the code won't compile, solutions that depend on the
compiler aren't any good.

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-02  0:00             ` Charles Hixson
  2000-03-02  0:00               ` David Starner
  2000-03-03  0:00               ` Larry Kilgallen
@ 2000-03-03  0:00               ` Marin D. Condic
  2000-03-03  0:00                 ` Scott Ingram
  2000-03-04  0:00               ` Robert Dewar
  3 siblings, 1 reply; 55+ messages in thread
From: Marin D. Condic @ 2000-03-03  0:00 UTC (permalink / raw)


Charles Hixson wrote:
> A good cross-reference tool would be better, but I haven't seen one
> recently.  (Probably because programs/libraries have gotten too voluminous
> for them to handle properly.)  I suppose what's really needed is something
> like a smarter version of JavaDoc.  Of course an integrated tool like
> genitor would be nice, but it needs to be tuned to one language (C++ of
> course) and is a trifle too expensive for my pocket-book (which runs more to
> the Source-Navigator level [again tied to C++]).

The Adagide editor that comes free with Gnat for the PC does a pretty
spiffy job of cross referencing stuff. You highlight the item in
question and use a menu option or Control-G and it jumps you to where
the thing is declared. The only weakness it has is that all of the code
in question needs to be compiled first in order to have all the cross
reference information available. When you're still in development mode
and don't have everything compiling successfully this can be a
hindrance. But then again, I don't know how you could get a cross
reference built without *some* level of parsing the code, so I'm kind of
wishing for the impossible. :-)

MDC
-- 
=============================================================
Marin David Condic   - Quadrus Corporation -   1.800.555.3393
1015-116 Atlantic Boulevard, Atlantic Beach, FL 32233
http://www.quadruscorp.com/
m c o n d i c @ q u a d r u s c o r p . c o m

***PLEASE REMOVE THE "-NOSPAM" PART OF MY RETURN ADDRESS***

Visit my web site at:  http://www.mcondic.com/

"Because that's where they keep the money."
    --  Willie Sutton when asked why he robbed banks. 
=============================================================




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-03  0:00               ` Marin D. Condic
@ 2000-03-03  0:00                 ` Scott Ingram
  2000-03-04  0:00                   ` Simon Wright
  0 siblings, 1 reply; 55+ messages in thread
From: Scott Ingram @ 2000-03-03  0:00 UTC (permalink / raw)


"Marin D. Condic" wrote:
> 
> The Adagide editor that comes free with Gnat for the PC does a pretty
> spiffy job of cross referencing stuff. You highlight the item in
> question and use a menu option or Control-G and it jumps you to where
> the thing is declared. The only weakness it has is that all of the code
> in question needs to be compiled first in order to have all the cross
> reference information available. When you're still in development mode
> and don't have everything compiling successfully this can be a
> hindrance. But then again, I don't know how you could get a cross
> reference built without *some* level of parsing the code, so I'm kind of
> wishing for the impossible. :-)
> 
> MDC
> --

Since I find myself this week assigned to maintain a body of legacy
Ada83
code from an outside vendor...I'll join Marin in wishing for the
impossible.
Ada-Mode for Emacs suffers the same limitation :(  which makes finding
one's
way around in 600 source files in which use is not used...
-- 
Scott Ingram
Sonar Processing and Analysis Laboratory
Johns Hopkins University Applied Physics Laboratory




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-02  0:00             ` Charles Hixson
                                 ` (2 preceding siblings ...)
  2000-03-03  0:00               ` Marin D. Condic
@ 2000-03-04  0:00               ` Robert Dewar
  2000-03-04  0:00                 ` Ehud Lamm
  2000-03-06  0:00                 ` Charles Hixson
  3 siblings, 2 replies; 55+ messages in thread
From: Robert Dewar @ 2000-03-04  0:00 UTC (permalink / raw)


In article <38BEF1A3.24B566BF@earthlink.net>,
  Charles Hixson <charleshixsn@earthlink.net> wrote:

> A good cross-reference tool would be better, but I haven't
> seen one recently.

Have you looked at the xref tools provided as part of GNAT?

> The trouble is that any tool that can tell enough to figure
> out where a link comes from, needs enough built in knowledge
> to be pretty expensive to build so unless AdaCore starts
> including it in the GNAT package, I'm unlikely to
> be able to afford it (which is why the tools I *am* aware of
> target C++).

Difficult to "start" including something that is already there!

GNAT by default generates full xref information in the ali files
for all compilations. This has been true for quite a while.

A number of tools use this information:

1. gnatxref, a conventional xref utility

2. gnatfind, more oriented to finding specific entities

3. ada mode for emacs, providing integrated "find the
   declaration of this entity", "jump to corresponding
   body" etc capabilities.

4. Similar capabilities integrated into GLIDE, the new
   integrated development environment for GNAT.

5. cross-referencing capabilities in AdaGIDE, as mentioned
   elsewhere in this thread.

The format of the ali files is quite simple, and fully
documented (in the lib-writ.adb file). The above tools
are likely to meet most people's requirements for
"cross-referencing" tools, but there are undoubtedly
other variations that would be useful. The whole idea
of this facility, of which you are apprently unaware,
is precisely to allow tool builders to build tools
of this kind without needing compiler smarts.

> The trouble is that any tool that can tell enough ...

Don't invent trouble where none exists :-)

Of course you can also use ASIS for heavier duty applications,
but it is remarkable how useful the basic entity cross-reference
information in the ali files is for many tool applications.

Robert Dewar
Ada Core Technologies


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-03  0:00                 ` Scott Ingram
@ 2000-03-04  0:00                   ` Simon Wright
  0 siblings, 0 replies; 55+ messages in thread
From: Simon Wright @ 2000-03-04  0:00 UTC (permalink / raw)


Scott Ingram <scott@silver.jhuapl.edu> writes:

> "Marin D. Condic" wrote:
> > 
> > The Adagide editor that comes free with Gnat for the PC does a pretty
> > spiffy job of cross referencing stuff. You highlight the item in
> > question and use a menu option or Control-G and it jumps you to where
> > the thing is declared. The only weakness it has is that all of the code
> > in question needs to be compiled first in order to have all the cross
> > reference information available. When you're still in development mode
> > and don't have everything compiling successfully this can be a
> > hindrance. But then again, I don't know how you could get a cross
> > reference built without *some* level of parsing the code, so I'm kind of
> > wishing for the impossible. :-)
> > 
> > MDC
> > --
> 
> Since I find myself this week assigned to maintain a body of legacy
> Ada83 code from an outside vendor...I'll join Marin in wishing for
> the impossible.  Ada-Mode for Emacs suffers the same limitation :(
> which makes finding one's way around in 600 source files in which
> use is not used...

Rational APEX (well, I've never had a hands-on, so this is only
based on experience with the old R1000 environment) will get you
instantly to declarations, uses. But (surprise) the code has to have
been at least partially compiled to do this.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-03  0:00                   ` David Starner
@ 2000-03-04  0:00                     ` Simon Wright
  0 siblings, 0 replies; 55+ messages in thread
From: Simon Wright @ 2000-03-04  0:00 UTC (permalink / raw)


dvdeug@x8b4e53cd.dhcp.okstate.edu (David Starner) writes:

> On Fri, 03 Mar 2000 01:25:51 GMT, Jeff Carter <jrcarter@acm.org> wrote:
> >David Starner wrote:
> >[referring to find-declaration tools]
> >> Ada mode for emacs (distributed by AdaCore) does do this, using gnatfind.
> >> Personally, I would prefer a lean mean code editor where it's easy to
> >> find the options you need, but ada-mode w/ xemacs is a decent "intellegent"
> >> editor for Ada.
> >
> >AdaGIDE, distributed by ACT with the Windows version of GNAT, has this
> >feature, too.
> 
> Not currently much use for us Un*x fans. It would be nice to have something
> like this for X, but I don't currently have the time to port it.

I can't check now, but it seems likely that AdaGIDE uses the same
underlying technology as the Emacs ada-mode.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-03  0:00       ` Charles H. Sampson
@ 2000-03-04  0:00         ` Jean-Pierre Rosen
  2000-03-06  0:00         ` Ted Dennison
  1 sibling, 0 replies; 55+ messages in thread
From: Jean-Pierre Rosen @ 2000-03-04  0:00 UTC (permalink / raw)


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


Charles H. Sampson <claveman@inetworld.net> a �crit dans le message :
1e6xw1b.crkgd5nhvbzuN%claveman@inetworld.net...
>      I can't remember where to find the paper, even though I'm sure I
> have one lost in the mass of papers in my office.  I think it was pub-
> lished in Ada Letters.  I've poked around adahome for a few minutes and
> couldn't find it there.  J-P?
>
Thanks for the kind words. It was published in Ada Letters, Vol VII, n�7.
You can view or download the paper from my "publications" page:
http://pro.wanadoo.fr/adalog/publica2.htm

--
---------------------------------------------------------
           J-P. Rosen (Rosen.Adalog@wanadoo.fr)
Visit Adalog's web site at http://pro.wanadoo.fr/adalog






^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-04  0:00               ` Robert Dewar
@ 2000-03-04  0:00                 ` Ehud Lamm
  2000-03-06  0:00                 ` Charles Hixson
  1 sibling, 0 replies; 55+ messages in thread
From: Ehud Lamm @ 2000-03-04  0:00 UTC (permalink / raw)


This talk about what comes with GNAT, prompts me to tell this anecdote. 
In the previous semseter we gave an exercise to output the "with-graph" of
an Ada system (start with the "main",follow the "with"s. Nothing too
fancy. This was explained in the exerices text). 

Of course, students said that this is hard to do, requires them to wirte
a parser for Ada (I wanted a line count of all files traversed...) etc.
etc.
No one said "Hey the ALI files have this info," not to mention find out
about the XREF reports the gnat tools give you.

(The exercise wasn't mandatory, so no one did it... So I don't have any
nice Ada parsers to share)


Ehud Lamm mslamm@mscc.huji.ac.il
http://purl.oclc.org/NET/ehudlamm <== My home on the web 
Check it out and subscribe to the E-List- for interesting essays and more!






^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-06  0:00                 ` Charles Hixson
@ 2000-03-06  0:00                   ` Robert Dewar
  0 siblings, 0 replies; 55+ messages in thread
From: Robert Dewar @ 2000-03-06  0:00 UTC (permalink / raw)


In article <38C3D86E.EE31E822@earthlink.net>,
  Charles Hixson <charleshixsn@earthlink.net> wrote:
>  It seems
> to be included as an afterthought rather than as an essential

tool.
> It seems to be neither included on a menu nor documented.


gnatfind and gnatxref are fully documented in the GNAT user's
guide. Indeed there is a top level entry

* The cross-referencing tools gnatxref and gnatfind::

in the manual that contains all the information you need to
know. I strongly recommend that anyone using GNAT read the
documentation, there is lots of useful stuff there :-)

Remember that AdaGIDE is intended just for simple student
use, for which it is very effective. And even students will
benefit by reading the GNAT documentation!

Robert Dewar
Ada Core Technologies


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-06  0:00         ` Ted Dennison
@ 2000-03-06  0:00           ` Robert Dewar
  2000-03-07  0:00             ` Ted Dennison
  2000-03-06  0:00           ` Ted Dennison
  2000-03-06  0:00           ` Charles H. Sampson
  2 siblings, 1 reply; 55+ messages in thread
From: Robert Dewar @ 2000-03-06  0:00 UTC (permalink / raw)


In article <8a0hio$qos$1@nnrp1.deja.com>,
  Ted Dennison <dennison@telepath.com> wrote:
> It seems to me that the whole argument hinged on the
> availability of tools to find declarations automaticly.

But certainly that is a reasonable expectation in any
decent Ada technology these days.


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-06  0:00           ` Ted Dennison
  2000-03-06  0:00             ` Robert A Duff
@ 2000-03-06  0:00             ` Robert Dewar
  2000-03-07  0:00               ` Marin D. Condic
  2000-03-07  0:00               ` Ted Dennison
  2000-03-07  0:00             ` Marin D. Condic
  2 siblings, 2 replies; 55+ messages in thread
From: Robert Dewar @ 2000-03-06  0:00 UTC (permalink / raw)


In article <8a0iam$r8a$1@nnrp1.deja.com>,
  Ted Dennison <dennison@telepath.com> wrote:
> Hmmm. It occurs to me that it would actually be far easier to
write a
> tool that can hide or show leading package names upon user
request. You
> don't need any fancy compiler interface or even compiling code
to do
> that.

You do need a compiler interface for a dotifier, since you
need to know what package things come from. The ali information
is certainly convenient for writing this tool.

The undotifier is harder since it has to know about potential
ambiguities.



Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-06  0:00         ` Ted Dennison
  2000-03-06  0:00           ` Robert Dewar
  2000-03-06  0:00           ` Ted Dennison
@ 2000-03-06  0:00           ` Charles H. Sampson
  2000-03-07  0:00             ` Stuart Palin
  2 siblings, 1 reply; 55+ messages in thread
From: Charles H. Sampson @ 2000-03-06  0:00 UTC (permalink / raw)


Ted Dennison <dennison@telepath.com> wrote:

> In article <1e6xw1b.crkgd5nhvbzuN%claveman@inetworld.net>,
>   claveman@inetworld.net (Charles H. Sampson) wrote:
> >      M. Rosen modestly omits that he wrote a very good paper several
> > years ago arguing in favor of the use clause.  While I was already a
> > strong use-phile before reading the paper, it clarified a number of
> > ideas that I had understood only instinctively.  I haven't read it in
> 
> I read that too. It seems to me that the whole argument hinged on the
> availability of tools to find declarations automaticly. So we are really
> talking in circles here.
> 
     Not really.  Here are his conclusions, quoted directly from the 
paper:

          We have argued here that the use clause, which allows 
     short names to be used in the usual case, improves readabil-
     ity, reliability, maintainability, and abstraction. The use of 
     expanded names has to be allowed for some special cases, but 
     not as the normal case.

          Of course, like any other feature, the use clause can be 
     abused of... and I don't know of any feature, even in Ada, 
     where this is not true . But apart from pathological cases, 
     reasonable use of the use clause provides more information to 
     the reader, and should be recommended as the usual practice.

The only place where he used the tools argument was in refuting (that's
too strong a word) the common argument that we need fully qualified 
names in order to be able to find an identifier's declaration easily.

                                Charlie

-- 
     To get my correct email address, replace the "claveman" by
"csampson" in my fake (anti-spam) address.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-03  0:00       ` Charles H. Sampson
  2000-03-04  0:00         ` Jean-Pierre Rosen
@ 2000-03-06  0:00         ` Ted Dennison
  2000-03-06  0:00           ` Robert Dewar
                             ` (2 more replies)
  1 sibling, 3 replies; 55+ messages in thread
From: Ted Dennison @ 2000-03-06  0:00 UTC (permalink / raw)


In article <1e6xw1b.crkgd5nhvbzuN%claveman@inetworld.net>,
  claveman@inetworld.net (Charles H. Sampson) wrote:
>      M. Rosen modestly omits that he wrote a very good paper several
> years ago arguing in favor of the use clause.  While I was already a
> strong use-phile before reading the paper, it clarified a number of
> ideas that I had understood only instinctively.  I haven't read it in

I read that too. It seems to me that the whole argument hinged on the
availability of tools to find declarations automaticly. So we are really
talking in circles here.

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-06  0:00         ` Ted Dennison
  2000-03-06  0:00           ` Robert Dewar
@ 2000-03-06  0:00           ` Ted Dennison
  2000-03-06  0:00             ` Robert A Duff
                               ` (2 more replies)
  2000-03-06  0:00           ` Charles H. Sampson
  2 siblings, 3 replies; 55+ messages in thread
From: Ted Dennison @ 2000-03-06  0:00 UTC (permalink / raw)


In article <8a0hio$qos$1@nnrp1.deja.com>,
  Ted Dennison <dennison@telepath.com> wrote:
> In article <1e6xw1b.crkgd5nhvbzuN%claveman@inetworld.net>,
>   claveman@inetworld.net (Charles H. Sampson) wrote:
> >      M. Rosen modestly omits that he wrote a very good paper several
> > years ago arguing in favor of the use clause.  While I was already a
> > strong use-phile before reading the paper, it clarified a number of
> > ideas that I had understood only instinctively.  I haven't read it
>
> I read that too. It seems to me that the whole argument hinged on the
> availability of tools to find declarations automaticly. So we are

Hmmm. It occurs to me that it would actually be far easier to write a
tool that can hide or show leading package names upon user request. You
don't need any fancy compiler interface or even compiling code to do
that.

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-04  0:00               ` Robert Dewar
  2000-03-04  0:00                 ` Ehud Lamm
@ 2000-03-06  0:00                 ` Charles Hixson
  2000-03-06  0:00                   ` Robert Dewar
  1 sibling, 1 reply; 55+ messages in thread
From: Charles Hixson @ 2000-03-06  0:00 UTC (permalink / raw)


Robert Dewar wrote:

> --snip

> Difficult to "start" including something that is already there!
>

Well...
I am a total tyro at Ada, esp. GNAT.  I have intermittent contact
with it, and no deep familiarity.  So these comments are to be taken
as "Experiences than an untutored outsider might have."
After reading the e-mails I pulled up the AdaGIDE to search for a
cross-reference generator.  Nothing obvious.  So I pulled up the
help menu and searched there.  Nothing.
I accept that there is a cross-reference generator, but it doesn't
seem to make contact with the IDE.  The location of the
documentation is not obvious.  Etc.
The reference to gnatxref tells me the name of the program, and I
assume that if I invoke it as:
gnatxref -?
or some variation that I will get a list of options.  But the
existence was not obvious.  At first I was embarrassed to have
missed the very feature that I was asking for, however after
re-examining the situation from the standpoint of knowing that it
exists and what it's name was, I no longer feel that way.  It seems
to be included as an afterthought rather than as an essential tool.
It seems to be neither included on a menu nor documented.  If I had
been browsing through my disk catalog and encountered it, how
certain would I have been of its function?  Probably not very!  That
it was a cross-reference generator might well have been the primary
supposition, but that it might well be something else would
certainly have been in my thoughts.  I can't now know, of course,
but my guess is that I would have hesitated long before I tried to
use it.  So many programs do things which are not what one would
have guessed from their names.  (E.g., it might have been a program
for managing the database of library linkages, and the default
action might be to start a new library.)






^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-06  0:00           ` Ted Dennison
@ 2000-03-06  0:00             ` Robert A Duff
  2000-03-06  0:00               ` tmoran
  2000-03-06  0:00             ` Robert Dewar
  2000-03-07  0:00             ` Marin D. Condic
  2 siblings, 1 reply; 55+ messages in thread
From: Robert A Duff @ 2000-03-06  0:00 UTC (permalink / raw)


Ted Dennison <dennison@telepath.com> writes:

> Hmmm. It occurs to me that it would actually be far easier to write a
> tool that can hide or show leading package names upon user request. You
> don't need any fancy compiler interface or even compiling code to do
> that.

You would need something that can tell the difference between a package
name and, say, a record name.  That sounds a lot like a compiler front
end, to me.  ;-)

- Bob




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-06  0:00             ` Robert A Duff
@ 2000-03-06  0:00               ` tmoran
  0 siblings, 0 replies; 55+ messages in thread
From: tmoran @ 2000-03-06  0:00 UTC (permalink / raw)


>You would need something that can tell the difference between a package
>name and, say, a record name.  That sounds a lot like a compiler front
>end, to me.  ;-)
  But it's a very simple front end.  It doesn't require the code be
compilable, just parseable.  And if the code isn't yet to the stage of
being syntactically clean, you probably aren't to the stage of
wondering just where some function was defined.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-03  0:00                 ` Ted Dennison
@ 2000-03-07  0:00                   ` Nick Roberts
  0 siblings, 0 replies; 55+ messages in thread
From: Nick Roberts @ 2000-03-07  0:00 UTC (permalink / raw)


[Sharp intake of breath]

A compiler that refuses to update any of its ASIS database just because the
compilation failed (beyond the syntax phase)? Don't buy it!

;-)

--
Nick Roberts
http://www.adapower.com/lab/adaos

"Ted Dennison" <dennison@telepath.com> wrote in message
news:89oj9n$gkt$1@nnrp1.deja.com...
> ...
> That doesn't help at all in the (rather common) occurance where I'm
> called over to help another engineer figure out why their program isn't
> compiling. If the code won't compile, solutions that depend on the
> compiler aren't any good.







^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-06  0:00             ` Robert Dewar
  2000-03-07  0:00               ` Marin D. Condic
@ 2000-03-07  0:00               ` Ted Dennison
  1 sibling, 0 replies; 55+ messages in thread
From: Ted Dennison @ 2000-03-07  0:00 UTC (permalink / raw)


In article <8a1evn$hlm$1@nnrp1.deja.com>,
  Robert Dewar <robert_dewar@my-deja.com> wrote:
> In article <8a0iam$r8a$1@nnrp1.deja.com>,
>   Ted Dennison <dennison@telepath.com> wrote:
> > Hmmm. It occurs to me that it would actually be far easier to
> write a
> > tool that can hide or show leading package names upon user
> request. You

> The undotifier is harder since it has to know about potential
> ambiguities.

It would if things were being compiled that way. But what if its just
for human consumption (iow: display) and the full dot notation is what's
being kept in the text file? Then all it needs to know is the difference
between package names and record/access object names. That's not
entirely trivial, but certianly easier than parsing an entire file and
everything it depends on.

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-06  0:00           ` Robert Dewar
@ 2000-03-07  0:00             ` Ted Dennison
  2000-03-08  0:00               ` Robert Dewar
  0 siblings, 1 reply; 55+ messages in thread
From: Ted Dennison @ 2000-03-07  0:00 UTC (permalink / raw)


In article <8a1egu$h91$1@nnrp1.deja.com>,
  Robert Dewar <robert_dewar@my-deja.com> wrote:
> In article <8a0hio$qos$1@nnrp1.deja.com>,
>   Ted Dennison <dennison@telepath.com> wrote:
> > It seems to me that the whole argument hinged on the
> > availability of tools to find declarations automaticly.
>
> But certainly that is a reasonable expectation in any
> decent Ada technology these days.

I'm afraid I haven't used Gnat's xref. So perhaps in a maintenance phase
of an application environemnt that uses Gnat it is. But its *not* a
reasonable expectation if:
   o  It depends on a compiler and you are in a phase where the whole
system is not yet compiling.
   o  Someone might ever need to read the source code without benifit of
the tools. (Eg: printouts, site copies, etc.)
   o  Your system is large enough that it takes more than a couple of
seconds to gather this information (DEC's SCA had this problem. I could
usually figure it out myself with SEARCH before SCA came back with the
answer).

The first is a phase that every program goes through. I would claim that
the other situations are quite common in the industry.

I would further claim that, given this fact, it is improper to choose a
naming convention for a reusable package that might be used by someone
in one of the above situations, that looks stupid with the package name
on the front when there is a convention available that will not look
stupid under either either usage.

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-06  0:00           ` Charles H. Sampson
@ 2000-03-07  0:00             ` Stuart Palin
  2000-03-08  0:00               ` Robert Dewar
  0 siblings, 1 reply; 55+ messages in thread
From: Stuart Palin @ 2000-03-07  0:00 UTC (permalink / raw)


"Charles H. Sampson" wrote:

<snip>

>  Not really.  Here are his [M. Rosen] conclusions, quoted directly
>  from the paper [arguing in favour of the use clause]:

<snip>
 
>           Of course, like any other feature, the use clause can be
>      abused of... and I don't know of any feature, even in Ada,
>      where this is not true . But apart from pathological cases,
>      reasonable use of the use clause provides more information to
>      the reader, and should be recommended as the usual practice.

It seems to me that the points raised in the c.l.a thread
"choice of fixed point type" highlight an area where the "use" clause
can give rise to some concerns.

tmoran@bix.com wrote
> The code in question arose from testing around an "Ada
> surprise".  An execution error had been traced to where a
> programmer had written something like
>   Long_Float(N * Ada.Numerics.pi)   instead of
>   Long_Float(N) * Ada.Numerics.pi
> resulting in the use of (relatively imprecise) type Duration
> for the multiply instead of Long_Float.  Standard.Duration
> was of course (silently) visible, and there was no other
> fixed point type in this code, so the compiler did what the
> programmer said, but not what he wanted.

Although an explicit "use clause" was not part of the difficulty here,
it seems that bringing things into scope unnecessarily increases the
possibility of this type of anomaly; where what is said is not what is
wanted and the compiler does not report an error because it can
interpret what was said.

This type of "gotcha" is a legitimate concern.  Even so rigorous
abstention from the use clause only limits the risk, it does not
eliminate it (since the unintended behaviour might fall within the
bounds of those things that have been brought into scope by either
renaming or "use type").

In this example the difficulties of detecting the error by testing can
be recognized - the error would only be apparent if the values chosen
gave intermediate results that were significantly different from the
model numbers (and so introduced rounding errors).

Regards
--
Stuart Palin
BAE SYSTEMS Electronics Limited




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-06  0:00           ` Ted Dennison
  2000-03-06  0:00             ` Robert A Duff
  2000-03-06  0:00             ` Robert Dewar
@ 2000-03-07  0:00             ` Marin D. Condic
  2 siblings, 0 replies; 55+ messages in thread
From: Marin D. Condic @ 2000-03-07  0:00 UTC (permalink / raw)


Ted Dennison wrote:
> Hmmm. It occurs to me that it would actually be far easier to write a
> tool that can hide or show leading package names upon user request. You
> don't need any fancy compiler interface or even compiling code to do
> that.
> 
Now *thats* an idea! What if an Ada-oriented editor were to flag dotted
names such that they could be made visible or not? You have to type them
in initially (solves the problem of having to parse files that may not
be complete yet) but you can toggle them on/off and see which way makes
the code more clear. I'll have to cogitate on that one for a while.....

Maybe some of the tool-writers are listening? :-)

MDC
-- 
=============================================================
Marin David Condic   - Quadrus Corporation -   1.800.555.3393
1015-116 Atlantic Boulevard, Atlantic Beach, FL 32233
http://www.quadruscorp.com/
m c o n d i c @ q u a d r u s c o r p . c o m

***PLEASE REMOVE THE "-NOSPAM" PART OF MY RETURN ADDRESS***

Visit my web site at:  http://www.mcondic.com/

"Because that's where they keep the money."
    --  Willie Sutton when asked why he robbed banks. 
=============================================================




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-06  0:00             ` Robert Dewar
@ 2000-03-07  0:00               ` Marin D. Condic
  2000-03-07  0:00               ` Ted Dennison
  1 sibling, 0 replies; 55+ messages in thread
From: Marin D. Condic @ 2000-03-07  0:00 UTC (permalink / raw)


Robert Dewar wrote:
> You do need a compiler interface for a dotifier, since you
> need to know what package things come from. The ali information
> is certainly convenient for writing this tool.
> 
> The undotifier is harder since it has to know about potential
> ambiguities.
> 
Doing it in "fully-auto" mode may prove to be difficult or ambiguous, so
why not rely on brain-juice? If I start by typing in a fully qualified
name and then highlight it and tell the editor "show this as a
short-name unless otherwise directed" (or infix operator, or whatever)
It would let me pick and choose which qualified names I wanted shortened
and which should remain as-is.

The only problem I see is that the editor would have to store this
information in some manner with the code. You want the code to
ultimately be plain old ascii so that it works with the compiler and
other tools, but you'd want to embed markers in the text to indicate
what needs shortening, etc.

MDC
-- 
=============================================================
Marin David Condic   - Quadrus Corporation -   1.800.555.3393
1015-116 Atlantic Boulevard, Atlantic Beach, FL 32233
http://www.quadruscorp.com/
m c o n d i c @ q u a d r u s c o r p . c o m

***PLEASE REMOVE THE "-NOSPAM" PART OF MY RETURN ADDRESS***

Visit my web site at:  http://www.mcondic.com/

"Because that's where they keep the money."
    --  Willie Sutton when asked why he robbed banks. 
=============================================================




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-07  0:00             ` Ted Dennison
@ 2000-03-08  0:00               ` Robert Dewar
  2000-03-11  0:00                 ` Robert A Duff
  0 siblings, 1 reply; 55+ messages in thread
From: Robert Dewar @ 2000-03-08  0:00 UTC (permalink / raw)


In article <8a3959$qmg$1@nnrp1.deja.com>,
  Ted Dennison <dennison@telepath.com> wrote:

> I would further claim that, given this fact, it is improper to
> choose a naming convention for a reusable package that might
> be used by someone in one of the above situations, that looks
> stupid with the package name on the front when there is a
> convention available that will not look
> stupid under either either usage.


Depends, for those of us who like to use the whole language, it
looks "stupid" to have unnecessary qualification all over the
place.

As to whether your project must worry about the issues you
raise (e.g. reading the code on paper), that's of course
project specific.

It's interesting that the GNAT sources themselves use "USE"
very liberally, and everyone we know who has dug into these
sources reasonably deeply has found them extremely easy to
use. Yes, I occasionally issue a gnatfind command to locate
where an entity is defined (this by the way takes essentially
zero time even in a very large program), but only very
occasionally, and I would find the sources much less readable
if they were fully dotted.

It's partially a matter of taste, but to argue that your
approach of subsetting the language is the only "proper"
approach seems extreme. Yes, I realize that you are talking
about reusable packages, but you are taking the position that
the design of Ada 95 itself is improper. Everyone is entitled
to such opinions of course, but clearly you place yourself
in a small minority if you think Ada 95 is improperly designed
in this respect (no one even raised this issue in either the
DR's or WG9 during the design for example)


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-07  0:00             ` Stuart Palin
@ 2000-03-08  0:00               ` Robert Dewar
  2000-03-09  0:00                 ` Stuart Palin
  0 siblings, 1 reply; 55+ messages in thread
From: Robert Dewar @ 2000-03-08  0:00 UTC (permalink / raw)


In article <38C52D30.E1C7E85A@gecm.com>,
  Stuart Palin <stuart.palin@gecm.com> wrote:

> It seems to me that the points raised in the c.l.a thread
> "choice of fixed point type" highlight an area where the "use"
> clause can give rise to some concerns.

Nope, you are misreading the thread. This thread was about

a) ambiguities not detected that should be. Obviously adding
use clauses NEVER causes undetected ambiguities.

b) the concern that certain expressions are compiled
misleadingly because only one fixed-point type is
visible. Use clauses can *only* help in this regard.



Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-08  0:00               ` Robert Dewar
@ 2000-03-09  0:00                 ` Stuart Palin
  0 siblings, 0 replies; 55+ messages in thread
From: Stuart Palin @ 2000-03-09  0:00 UTC (permalink / raw)


Robert Dewar wrote:
> 
> In article <38C52D30.E1C7E85A@gecm.com>,
>   Stuart Palin <stuart.palin@gecm.com> wrote:
> 
> > It seems to me that the points raised in the c.l.a thread
> > "choice of fixed point type" highlight an area where the "use"
> > clause can give rise to some concerns.
> 
> Nope, you are misreading the thread. This thread was about

Quite possibly!

> a) ambiguities not detected that should be. Obviously adding
> use clauses NEVER causes undetected ambiguities.

True - because the compiler is supposed to report an error if there is
an ambiguity.

> b) the concern that certain expressions are compiled
> misleadingly because only one fixed-point type is
> visible. Use clauses can *only* help in this regard.

This is more the area I was concerned with.

First a caveat - I am working with Ada-83, and I do not know whether
what follows works
differently under Ada-95.

Suppose I (rather pathologically) have:
  package P1 is
    type Gx is range -1000..1000;
    function I return Gx;
    function K return float;
  end P1;

  package P2 is
    type Fx is delta 0.1 range -200.0 .. 200.0;
    function I return Fx;
    function K return Fx;
  end P2;

And then I start writing a new package:

  package P3 is
  end P3;

  with P1, P2; use P1,P2;
  package body P3 is
    X : float;
  begin
    -- Now I "intend" to do :  X := float(P1.I) * P1.K;

    -- But foolishly write:
    X := float(I * K);

    -- This will be compiled (under Ada-83) as :  X := float(P2.I *
P2.K);

  end P3;

If I had written (what I probably should have written if I did not
believe there was an
ambiguity due to P2 being in scope)

  X := float(I) * K;

then the compiler would have warned me about the ambiguity (at least of
I).

I believe it is a concern that a mistake can be hidden, because another
valid (but unexpected) meaning can be "found" by the compiler, that
leads people to "distrust" using "use".

Regards
--
Stuart Palin
BAE SYSTEMS Electronics Limited




^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: 'with'ing and 'use'ing
  2000-03-08  0:00               ` Robert Dewar
@ 2000-03-11  0:00                 ` Robert A Duff
  0 siblings, 0 replies; 55+ messages in thread
From: Robert A Duff @ 2000-03-11  0:00 UTC (permalink / raw)


Robert Dewar <robert_dewar@my-deja.com> writes:

> As to whether your project must worry about the issues you
> raise (e.g. reading the code on paper), that's of course
> project specific.

Well, I still read programs on paper fairly often.  I don't know of
*any* project that has access to screens that even approach the
resolution of cheap laser printers.  And the number of dots per inch is
important to me, for readability -- that part isn't "project specific".

Of course, even when I'm using paper, I usually have a computer nearby
that can do fancy searches and whatnot.

- Bob




^ permalink raw reply	[flat|nested] 55+ messages in thread

end of thread, other threads:[~2000-03-11  0:00 UTC | newest]

Thread overview: 55+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-02-29  0:00 'with'ing and 'use'ing Roger Hoyle
2000-02-29  0:00 ` Jeffrey Carter
2000-02-29  0:00   ` Brian Rogoff
2000-03-01  0:00     ` Jean-Pierre Rosen
2000-03-02  0:00       ` Charles Hixson
2000-03-02  0:00         ` Robert A Duff
2000-03-02  0:00           ` Ted Dennison
2000-03-02  0:00             ` Charles Hixson
2000-03-02  0:00               ` David Starner
2000-03-03  0:00                 ` Ted Dennison
2000-03-07  0:00                   ` Nick Roberts
2000-03-03  0:00                 ` Jeff Carter
2000-03-03  0:00                   ` David Starner
2000-03-04  0:00                     ` Simon Wright
2000-03-03  0:00               ` Larry Kilgallen
2000-03-03  0:00               ` Marin D. Condic
2000-03-03  0:00                 ` Scott Ingram
2000-03-04  0:00                   ` Simon Wright
2000-03-04  0:00               ` Robert Dewar
2000-03-04  0:00                 ` Ehud Lamm
2000-03-06  0:00                 ` Charles Hixson
2000-03-06  0:00                   ` Robert Dewar
2000-03-03  0:00       ` Charles H. Sampson
2000-03-04  0:00         ` Jean-Pierre Rosen
2000-03-06  0:00         ` Ted Dennison
2000-03-06  0:00           ` Robert Dewar
2000-03-07  0:00             ` Ted Dennison
2000-03-08  0:00               ` Robert Dewar
2000-03-11  0:00                 ` Robert A Duff
2000-03-06  0:00           ` Ted Dennison
2000-03-06  0:00             ` Robert A Duff
2000-03-06  0:00               ` tmoran
2000-03-06  0:00             ` Robert Dewar
2000-03-07  0:00               ` Marin D. Condic
2000-03-07  0:00               ` Ted Dennison
2000-03-07  0:00             ` Marin D. Condic
2000-03-06  0:00           ` Charles H. Sampson
2000-03-07  0:00             ` Stuart Palin
2000-03-08  0:00               ` Robert Dewar
2000-03-09  0:00                 ` Stuart Palin
2000-02-29  0:00 ` David Starner
2000-02-29  0:00 ` Robert A Duff
2000-02-29  0:00   ` Ted Dennison
2000-03-01  0:00   ` Robert Dewar
2000-02-29  0:00 ` xl
2000-02-29  0:00   ` Jeffrey Carter
2000-02-29  0:00     ` xl
2000-03-01  0:00   ` Roger Hoyle
2000-02-29  0:00 ` Ted Dennison
2000-03-01  0:00   ` Robert Dewar
2000-03-01  0:00     ` Ted Dennison
2000-03-01  0:00       ` Robert Dewar
2000-03-01  0:00         ` Ted Dennison
2000-03-01  0:00           ` Wes Groleau
2000-03-02  0:00             ` Robert Dewar

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