comp.lang.ada
 help / color / mirror / Atom feed
* ADA FUNCTIONS TO PROCEDURES
@ 1995-03-08  3:24 Tuan Anh Nguyen
  1995-03-09 12:05 ` Robert Dewar
  1995-03-09 12:06 ` Robert Dewar
  0 siblings, 2 replies; 11+ messages in thread
From: Tuan Anh Nguyen @ 1995-03-08  3:24 UTC (permalink / raw)


Hi,
I'm looking for a utility program that would allow me to convert all
functions into procedures.
For example:

functions equal(Left:  in int;
                Right: in int) return Boolean;

in the specification add the following:

procedure equal(Left:   in int;
                Right:  in int;
                Result: in Boolean);

and in the body add the following:


procedure equal(Left:   in int;
                Right:  in int;
                Result: in Boolean) is
begin
   Result := equal(Left,Right);
end equal;


Please email to tanguyen@nps.navy.mil
Thanks





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

* Re: ADA FUNCTIONS TO PROCEDURES
  1995-03-08  3:24 ADA FUNCTIONS TO PROCEDURES Tuan Anh Nguyen
@ 1995-03-09 12:05 ` Robert Dewar
  1995-03-09 12:06 ` Robert Dewar
  1 sibling, 0 replies; 11+ messages in thread
From: Robert Dewar @ 1995-03-09 12:05 UTC (permalink / raw)


You may have better luck converting functions to procedures if you make
the result be an OUT parameter :-)




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

* Re: ADA FUNCTIONS TO PROCEDURES
  1995-03-08  3:24 ADA FUNCTIONS TO PROCEDURES Tuan Anh Nguyen
  1995-03-09 12:05 ` Robert Dewar
@ 1995-03-09 12:06 ` Robert Dewar
  1 sibling, 0 replies; 11+ messages in thread
From: Robert Dewar @ 1995-03-09 12:06 UTC (permalink / raw)


Can you tell us, just for curiosity, why anyone would want such a tool?
I would be surprised if one exists, because I can't see any legitimate use
for it!




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

* Re: ADA FUNCTIONS TO PROCEDURES
@ 1995-03-10 15:56 CONDIC
  1995-03-10 22:20 ` Henri Altarac
  0 siblings, 1 reply; 11+ messages in thread
From: CONDIC @ 1995-03-10 15:56 UTC (permalink / raw)


From: Marin David Condic, 407.796.8997, M/S 731-93
Subject: Re: ADA FUNCTIONS TO PROCEDURES
Original_To:  PROFS%"SMTP@PWAGPDB"
Original_cc:  CONDIC



Robert Dewar <dewar@CS.NYU.EDU> writes:
>
>Can you tell us, just for curiosity, why anyone would want such a tool?
>I would be surprised if one exists, because I can't see any legitimate use
>for it!
>
I'd be inclined to agree, except for one possible issue.
Depending on the compiler, target hardware, etc. it's concievable
that there might be more overhead associated with a function call
than a procedure call. In some applications where you might be
fighting for every microsecond, even a relatively small savings
in overhead might make it worth the effort. That way, you can
program with the "function" call where it makes good programming
sense, yet do a conversion prior to compilation to squeeze a few
extra ergs out of the application.

Of course, I don't know if that's the issue here - just a guess
as to why someone *might* want to find such a tool.

Pax,
Marin
Marin David Condic, Senior Computer Engineer    ATT:        407.796.8997
M/S 731-93                                      Technet:    796.8997
Pratt & Whitney, GESP                           Internet:   CONDICMA@PWFL.COM
P.O. Box 109600                                 Internet:   MDCONDIC@AOL.COM
West Palm Beach, FL 33410-9600
===============================================================================
    Please send responses to one of the addresses in this trailer.
    A "reply" to the address in the message header will bounce.
===============================================================================
   "If you don't say anything, you won't be called on to repeat it."

        -- Calvin Coolidge
===============================================================================



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

* Re: ADA FUNCTIONS TO PROCEDURES
  1995-03-10 15:56 CONDIC
@ 1995-03-10 22:20 ` Henri Altarac
  1995-03-11 16:26   ` Pug 156
  1995-03-11 21:27   ` James A. Krzyzanowski
  0 siblings, 2 replies; 11+ messages in thread
From: Henri Altarac @ 1995-03-10 22:20 UTC (permalink / raw)


CONDIC@PSAVAX.PWFL.COM wrote:
>
> 
> Robert Dewar <dewar@CS.NYU.EDU> writes:
> >
> >Can you tell us, just for curiosity, why anyone would want such a tool?
> >I would be surprised if one exists, because I can't see any legitimate use
> >for it!
> >
> I'd be inclined to agree, except for one possible issue.

I have another possible reason.

In some (strange) coding standard I saw, they required that
function should not have any side effects. Procedure could.

-----
Henri Altarac 



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

* Re: ADA FUNCTIONS TO PROCEDURES
  1995-03-10 22:20 ` Henri Altarac
@ 1995-03-11 16:26   ` Pug 156
  1995-03-11 21:27   ` James A. Krzyzanowski
  1 sibling, 0 replies; 11+ messages in thread
From: Pug 156 @ 1995-03-11 16:26 UTC (permalink / raw)


I have never seen such a tool.  But, if one were to write it, it would be
required to have the *calling* software submitted to the tool, as well as
the subprograms in question.

Besides the obvious problem of converting the calls from function notation
into procedural,  it would have to be able to "unnest" function calls,
create the necessary temporary variables for each level of unnesting, and
line up the calls to the procedures such that the temporary variables get
populated correctly.  Not a trivial bit of work.  

As I don't really have time to gen up this sort of thing, I suggest a
professor assign it to the class.  Give them access to a parser, so they
don't have to sort that bit out.



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

* Re: ADA FUNCTIONS TO PROCEDURES
  1995-03-10 22:20 ` Henri Altarac
  1995-03-11 16:26   ` Pug 156
@ 1995-03-11 21:27   ` James A. Krzyzanowski
  1995-03-11 22:24     ` David Weller
  1 sibling, 1 reply; 11+ messages in thread
From: James A. Krzyzanowski @ 1995-03-11 21:27 UTC (permalink / raw)


Henri Altarac (haltarac@rain.org) wrote:
: CONDIC@PSAVAX.PWFL.COM wrote:
: >
: > 
: > Robert Dewar <dewar@CS.NYU.EDU> writes:
: > >
: > >Can you tell us, just for curiosity, why anyone would want such a tool?
: > >I would be surprised if one exists, because I can't see any legitimate use
: > >for it!
: > >
: > I'd be inclined to agree, except for one possible issue.

: I have another possible reason.

: In some (strange) coding standard I saw, they required that
: function should not have any side effects. Procedure could.

: -----
: Henri Altarac 

What's so strange about that?  At Magnavox, we DO have that as a coding
standard!
--
Not necessarily the opinion of the company...
--
---------------------------------------------------------------------------
James A. Krzyzanowski - Senior Software Engineer - AFATDS
Magnavox Electronic Systems Company * Fort Wayne, IN 46808 * (219) 429-6446
jakrzy@most.magec.com        Opinions_Expressed := (Mine and not Magnavox);
            "I'd rather be right than politically correct !!!"
---------------------------------------------------------------------------



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

* Re: ADA FUNCTIONS TO PROCEDURES
  1995-03-11 21:27   ` James A. Krzyzanowski
@ 1995-03-11 22:24     ` David Weller
  1995-03-12  3:21       ` Henri Altarac
  1995-03-13 17:39       ` James A. Krzyzanowski
  0 siblings, 2 replies; 11+ messages in thread
From: David Weller @ 1995-03-11 22:24 UTC (permalink / raw)


In article <D5Aoy5.JCH@ss3.magec.com>,
James A. Krzyzanowski <jakrzy@ss5.magec.com> wrote:
>Henri Altarac (haltarac@rain.org) wrote:
>
>: In some (strange) coding standard I saw, they required that
>: function should not have any side effects. Procedure could.
>
>What's so strange about that?  At Magnavox, we DO have that as a coding
>standard!

I think he was implying it was strange because it required it in a
strict sense (?).  We have the "No side effect" rule in our standard
too, but it's immediately followed up with a statement that one MAY
break the rule if 1) it provides a more readable product, 2) it is a
"safe" usage ( a good example is the state of a random number
generator), and 3) It passes a code review of peers and at least one
"expert"


-- 
      Frustrated with C, C++, Pascal, Fortran?  Ada95 _might_ be for you!
	  For all sorts of interesting Ada95 tidbits, run the command:
"finger dweller@starbase.neosoft.com | more" (or e-mail with "finger" as subj.)
	



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

* Re: ADA FUNCTIONS TO PROCEDURES
  1995-03-11 22:24     ` David Weller
@ 1995-03-12  3:21       ` Henri Altarac
  1995-03-13 19:34         ` Bob Kitzberger
  1995-03-13 17:39       ` James A. Krzyzanowski
  1 sibling, 1 reply; 11+ messages in thread
From: Henri Altarac @ 1995-03-12  3:21 UTC (permalink / raw)


dweller@Starbase.NeoSoft.COM (David Weller) wrote:
>
> In article <D5Aoy5.JCH@ss3.magec.com>,
> James A. Krzyzanowski <jakrzy@ss5.magec.com> wrote:
> >Henri Altarac (haltarac@rain.org) wrote:
> >
> >: In some (strange) coding standard I saw, they required that
> >: function should not have any side effects. Procedure could.
> >
> >What's so strange about that?  At Magnavox, we DO have that as a coding
> >standard!
> 
> I think he was implying it was strange because it required it in a
> strict sense (?).  We have the "No side effect" rule in our standard
> too, but it's immediately followed up with a statement that one MAY
> break the rule if 1) it provides a more readable product, 2) it is a
> "safe" usage ( a good example is the state of a random number
> generator), and 3) It passes a code review of peers and at least one
> "expert"
> 

David is correct. The coding standard is was thinking about was 
very poor : nothing was explained/justified and many rules were
to strict and limitative. At the opposite of the SPC guide.

Also I consider any limitation should be automatically verified
by some tool used along the compiler and the side effect rule is
one that is quite hard to implement.

And even then, you always find somebody to work around the rule
like using an automatic tool to transform functions to procedures...

-----
Henri Altarac




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

* Re: ADA FUNCTIONS TO PROCEDURES
  1995-03-11 22:24     ` David Weller
  1995-03-12  3:21       ` Henri Altarac
@ 1995-03-13 17:39       ` James A. Krzyzanowski
  1 sibling, 0 replies; 11+ messages in thread
From: James A. Krzyzanowski @ 1995-03-13 17:39 UTC (permalink / raw)


David Weller (dweller@Starbase.NeoSoft.COM) wrote:
: In article <D5Aoy5.JCH@ss3.magec.com>,
: James A. Krzyzanowski <jakrzy@ss5.magec.com> wrote:
: >Henri Altarac (haltarac@rain.org) wrote:
: >
: >: In some (strange) coding standard I saw, they required that
: >: function should not have any side effects. Procedure could.
: >
: >What's so strange about that?  At Magnavox, we DO have that as a coding
: >standard!

: I think he was implying it was strange because it required it in a
: strict sense (?).  We have the "No side effect" rule in our standard
: too, but it's immediately followed up with a statement that one MAY
: break the rule if 1) it provides a more readable product, 2) it is a
: "safe" usage ( a good example is the state of a random number
: generator), and 3) It passes a code review of peers and at least one
: "expert"

Yes, we do have the same exception; I just did not want to confuse the
discussion with practical facts ;^}
--
Not necessarily the opinion of the company...
--
---------------------------------------------------------------------------
James A. Krzyzanowski - Senior Software Engineer - AFATDS
Magnavox Electronic Systems Company * Fort Wayne, IN 46808 * (219) 429-6446
jakrzy@most.magec.com        Opinions_Expressed := (Mine and not Magnavox);
            "I'd rather be right than politically correct !!!"
---------------------------------------------------------------------------



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

* Re: ADA FUNCTIONS TO PROCEDURES
  1995-03-12  3:21       ` Henri Altarac
@ 1995-03-13 19:34         ` Bob Kitzberger
  0 siblings, 0 replies; 11+ messages in thread
From: Bob Kitzberger @ 1995-03-13 19:34 UTC (permalink / raw)


Before we collectively go off the deep end...

I contacted the original poster -- he wanted to convert functions to
procedures becauase a downstream tool (that appears to parse the
Ada source) can't handle functions.  Nothing sinister, nothing
deeply performance driven...

(and yes, I suggested ASIS, etc.)

--
Bob Kitzberger	        +1 (916) 274-3075	        rlk@rational.com
Rational Software Corp., 10565 Brunswick Rd. #11, Grass Valley, CA 95945
  "...the solution to the problem is usually to pee on it"  -- Dave Barry



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

end of thread, other threads:[~1995-03-13 19:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-03-08  3:24 ADA FUNCTIONS TO PROCEDURES Tuan Anh Nguyen
1995-03-09 12:05 ` Robert Dewar
1995-03-09 12:06 ` Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
1995-03-10 15:56 CONDIC
1995-03-10 22:20 ` Henri Altarac
1995-03-11 16:26   ` Pug 156
1995-03-11 21:27   ` James A. Krzyzanowski
1995-03-11 22:24     ` David Weller
1995-03-12  3:21       ` Henri Altarac
1995-03-13 19:34         ` Bob Kitzberger
1995-03-13 17:39       ` James A. Krzyzanowski

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