comp.lang.ada
 help / color / mirror / Atom feed
* Refactoring and Ada
@ 2002-02-01 15:13 Paul Anderson
  2002-02-02 17:48 ` Nick Roberts
                   ` (3 more replies)
  0 siblings, 4 replies; 75+ messages in thread
From: Paul Anderson @ 2002-02-01 15:13 UTC (permalink / raw)



Hi!

As part of a government research contract, we are developing a
Refactoring editor for Ada.  I am interested in soliciting opinions
from the group about Refactoring and Ada.

For those that don't know, Refactoring is defined as "a technique to
restructure code in a disciplined way."  It has been associated with
Extreme Programming, but stands on its own as a highly useful
technique.  General information about Refactoring can be found at
http://www.refactoring.com.

I am interested in finding out if there are any Ada projects out there
that actively use refactoring.  If so, what refactorings do you use?
Are they just like the Java ones, or are there features of Ada that
mandate special-purpose refactorings?  What features would you like to
see in a refactoring editor for Ada?

I am especially interested in any use of refactoring in support of
legacy code, either to clean up code that has been automatically
translated to Ada, or to prepare Ada code so that it can be translated
more easily into something else.

Best regards, and thanks in advance for your input.

Paul.

______
Paul Anderson.  GrammaTech, Inc.    Tel: +1 607 273-7340 x18
mailto:paul@grammatech.com  http://www.grammatech.com



^ permalink raw reply	[flat|nested] 75+ messages in thread
* Re: Refactoring and Ada
@ 2002-02-05  6:15 Christoph Grein
  0 siblings, 0 replies; 75+ messages in thread
From: Christoph Grein @ 2002-02-05  6:15 UTC (permalink / raw)


> > By the way, I talked to a never-ever-use-use user of Ada
> > the other day who was appalled to discover that even if
> > you don't use USE clauses, you can have a case where you
> > write
> > 
> >        a := f (x);
> > 
> > where there were no other occurrences of f in the same
> > source file, no USE clauses, and the textual declaration
> > of f was in another unit [call it p].
> 
> You mean if x has a type which is derived from another one in a different
> package. So f is an inherited function. Right ? Or is there another case ?

Of course there are other cases (child packages), but there qualifying p.f would 
be legal. With inheritance, p.f is illegal as Robert said.



^ permalink raw reply	[flat|nested] 75+ messages in thread
* Re: Refactoring and Ada
@ 2002-02-07 11:26 Christoph Grein
  2002-02-07 18:31 ` Dr. Michael Paus
  0 siblings, 1 reply; 75+ messages in thread
From: Christoph Grein @ 2002-02-07 11:26 UTC (permalink / raw)


> > I often find that people think that avoiding use clauses
> > avoids this, and requires full qualification. In fact in
> > the above example, suppose the only other occurrence of
> > f is in package p, then it is the case that trying to
> > qualify by writing
> > 
> >        a := p.f (x);
> > 
> > is not just unnecessary, but in fact illegal.
> 
> If I understand your example correctly, it reflects a problem
> which I recently had to fix in program written by someone else.
> We had the requirement not to use use and so the call of f had
> to be qualified as in your example above. The compiler complained
> about this of course and can you imagine what the programmer did
> in order to fix the problem? The type of x (B_Type) was derived from
> some other type (let's say A_Type). So the programmer wrote:
> 
>        a := p.f (p.A_Type(x));
> 

Silliness is indeed unbounded. The person requiring qualification of
of the call of f should have been sent to purgatory immediately.

The programmer should have declined to do this and explain the reason
why.

> The compiler was happy and in this particular case the program
> even did what it was assumed to do. The hidden bug in this
> statement is a maintenance time-bomb which would not have occurred
> if use had been used.

But I do not see how "use" comes into the picture here.

> Michael



^ permalink raw reply	[flat|nested] 75+ messages in thread
* Re: Refactoring and Ada
@ 2002-02-20  6:19 Christoph Grein
  0 siblings, 0 replies; 75+ messages in thread
From: Christoph Grein @ 2002-02-20  6:19 UTC (permalink / raw)


> > It turns out that 'Valid is not as useful as many of us thought it was. For
> > example,  the result of an erroneous result from unchecked conversion,
> > which we originally thought was harmless if we checked it ourselves
> > with 'Valid before using it is a problem.   Consider the following,
> > 
> >                type X is ... ;
> >                type Y is ... ;
> > 
> >                function Convert is new Ada.Unchecked_Conversion
> >                                          (Source => Y, Target => X);
> > 
> >                 X := Convert (Y);     -- suppose X is erroneous or not valid
> >                 if X'Valid then ...      -- We used to think this was OK.
> >                                                  -- Some compilers fail on 
this because of an
> > interpretation
> >                                                  -- of the ALRM rules.
> > 
> >  At present, one must wonder about the usefulness of 'Valid.
> 
> There is an AI with a binding interpretation that was included in the
> TC that says that at least for scalar types the above code is
> not errorious and must work as expected.
> 
> SO any compiler that fail on the above are non-compliant.

I've got  the AARM with COR.1:2000 in front of me. There are no changes in 13.9, 
13.9.1, 13.9.2.
Thus a compiler failing to handle the above correctly has always been buggy.

Note that 'Valid exists for scalar objects only.



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

end of thread, other threads:[~2002-02-26  1:05 UTC | newest]

Thread overview: 75+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-01 15:13 Refactoring and Ada Paul Anderson
2002-02-02 17:48 ` Nick Roberts
2002-02-02 20:36   ` Pat Rogers
2002-02-03  0:21     ` Nick Roberts
2002-02-03 13:53       ` Robert Dewar
2002-02-03 19:23         ` Nick Roberts
2002-02-04  2:17           ` Robert Dewar
2002-02-04 20:48             ` Nick Roberts
2002-02-04 22:31               ` Pat Rogers
2002-02-04 22:43                 ` Marin David Condic
2002-02-06  2:51                 ` Nick Roberts
2002-02-03 18:50       ` Simon Wright
2002-02-04  4:32     ` Richard Riehle
2002-02-04 12:28       ` David C. Hoos, Sr.
2002-02-04 17:03         ` Richard Riehle
2002-02-06 17:19           ` Robert A Duff
2002-02-04 17:59       ` Robert Dewar
2002-02-04 18:50         ` Pascal Obry
2002-02-05  1:07           ` Robert Dewar
2002-02-05  1:44         ` Richard Riehle
2002-02-06 17:42           ` Robert A Duff
2002-02-06 17:32         ` Robert A Duff
2002-02-07  8:45         ` Dr. Michael Paus
2002-02-07 13:54           ` Pat Rogers
2002-02-03 13:48   ` Robert Dewar
2002-02-03 19:38     ` Nick Roberts
2002-02-04  2:20       ` Robert Dewar
2002-02-08 21:21       ` Paul Anderson
2002-02-03  9:45 ` Volkert
2002-02-04  0:06 ` Refactoring and Ada (tool I'd like to have...) David Emery
2002-02-08  9:24 ` Refactoring and Ada Martin Dowie
2002-02-08 15:15   ` Ted Dennison
2002-02-08 15:52     ` Pat Rogers
2002-02-08 16:07       ` OT : " martin.m.dowie
2002-02-08 17:11         ` Pat Rogers
2002-02-09 19:46           ` martin.m.dowie
2002-02-09 23:04             ` Pat Rogers
2002-02-10 13:57               ` Martin Dowie
2002-02-08 16:06     ` martin.m.dowie
2002-02-08 17:07       ` Pat Rogers
2002-02-09 19:48         ` martin.m.dowie
2002-02-09 23:05           ` Pat Rogers
2002-02-10  1:30     ` Marc A. Criley
2002-02-10  2:58       ` tmoran
2002-02-11 15:27       ` Marin David Condic
2002-02-12 19:16         ` Simon Wright
2002-02-15 19:43           ` Marin David Condic
2002-02-15 20:33           ` Matthew Heaney
2002-02-15 21:40             ` Larry Kilgallen
2002-02-19 16:54               ` Matthew Heaney
2002-02-19 19:39                 ` Larry Kilgallen
2002-02-20  4:23                   ` Richard Riehle
2002-02-20  5:20                     ` Mark Biggar
2002-02-20  9:58                     ` Pat Rogers
2002-02-20 17:14                       ` Matthew Heaney
2002-02-20 17:18                         ` Pat Rogers
2002-02-20 18:08                           ` Matthew Heaney
2002-02-20 22:12                             ` Pat Rogers
2002-02-23 22:48                             ` Robert Dewar
2002-02-21  0:41                           ` Randy Brukardt
2002-02-21  1:31                             ` Pat Rogers
2002-02-22 14:37                             ` Pat Rogers
2002-02-22 21:23                               ` Randy Brukardt
2002-02-23 23:04                                 ` Robert Dewar
2002-02-25 20:26                                   ` Randy Brukardt
2002-02-23 23:21                                 ` Robert Dewar
2002-02-23 22:58                             ` Robert Dewar
2002-02-23 22:55                     ` Robert Dewar
2002-02-26  1:05                       ` Nick Roberts
  -- strict thread matches above, loose matches on Subject: below --
2002-02-05  6:15 Christoph Grein
2002-02-07 11:26 Christoph Grein
2002-02-07 18:31 ` Dr. Michael Paus
2002-02-08 12:45   ` Robert Dewar
2002-02-08 17:20     ` Dr. Michael Paus
2002-02-20  6:19 Christoph Grein

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