comp.lang.ada
 help / color / mirror / Atom feed
From: "W. Wesley Groleau (Wes)" <wwgrol@PSESERV3.FW.HAC.COM>
Subject: Lang. Design Query (no practical value)
Date: 1996/08/15
Date: 1996-08-15T00:00:00+00:00	[thread overview]
Message-ID: <9608151648.AA07688@most> (raw)


The answer to this question will make no practical difference, but I'm
still curious.

I am trying to track down cases of abuse of access types and heap space.
I use a run-time call to get a stack trace, and then I start from the top
and work down looking for local variables that contain pointers but are
not cleaned up (Ada 83--no auto-finalize).  Since I didn't write the
code, I have to go to other files to check parameter modes when the items
in question are used for actuals.  I suppose the writer knew when he/she
wrote the call what the modes were, and had some idea of what the call
would do with the actuals.  Yet sometimes stuff both in and out of the
call makes me wonder.  (Like putting a non-null pointer on an out parameter,
or assigning null to the parameter within the call.)
More often than not, neither the formals nor the actuals were named in
a way that would provide a clue.

What do some of you experienced multi-language folks think would have been
the advantages or disadvantages of the following "alternate Ada" ?

procedure Do_Something ( This_Thing  : in     This_Type;
                         That_Thing  :    out That_Type;
                         Other_Thing : in out Other_Type );

Hypothetical call:

   A_Package.Do_Something ( This_Thing   => Voici,
                            That_Thing  <=  Voila,
                            Other_Thing <=> Aussi );
where the choice of [which kind of] arrow must match the parameter mode.

The writer of the call would not be able to avoid knowing the mode--but
is that necessarily a Good Thing?

The comparison operator would be "overloaded" but the context would make
it safe for the compiler, except when 'That_Thing' just happens to be
a local object, and a "<=" just happens to be defined to return the
expected type, and positional association is used.  Impossible in this
case--can't have That_Thing positional if This_Thing isn't.  But possible
in the following foolish code:

...

Formal : Boolean;
Actual : Boolean;

begin

  if "not" (Formal <= Actual) then ...

Anyway, the answer(s) won't change anything, but if things get slow on
comp.lang.ada and you don't have any work to do......

---------------------------------------------------------------------------
W. Wesley Groleau (Wes)                                Office: 219-429-4923
Hughes Defense Communications (MS 10-40)                 Home: 219-471-7206
Fort Wayne,  IN   46808                  (Unix): wwgrol@pseserv3.fw.hac.com
---------------------------------------------------------------------------




             reply	other threads:[~1996-08-15  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-08-15  0:00 W. Wesley Groleau (Wes) [this message]
1996-08-18  0:00 ` Lang. Design Query (no practical value) Robert A Duff
1996-08-18  0:00   ` Robert Dewar
replies disabled

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