comp.lang.ada
 help / color / mirror / Atom feed
* Re: QUERY ABOUT MONITOR
@ 1993-08-10 14:00 Robert Dewar
  0 siblings, 0 replies; 6+ messages in thread
From: Robert Dewar @ 1993-08-10 14:00 UTC (permalink / raw)


Mike repeats a common myth about Fortran, namely that it requires arrays to
be passed by reference. This is rubbish. In fact Ada tried to copy Fortran's
approach carefully. Both Ada and Fortran allow composite objects to be passed
by reference or value, as decided by the compiler. Any Fortran code that
counts on pass by reference is faulty (Mike if you don't believe this, settl
down with the Fortran standard, it's perfectly clear there).

However, in practice, both in Ada and Fortran, arrays are typically passed by
reference, so this is from a pragmatic point of view a non-issue.

All Ada compilers I know of lay out arrays contiguously (interestingly enough
Mike makes the opposite mistake here, Fortran DOES require arrays to be laid
out contiguously, it's not an obvious requirement, but it is a ramification
of the rules for passing arrays in Fortran). So that also is not in practice
a problem.

Now what about passing descriptors etc. Well we obviously must have pragma
Interface FORTRAN available in an Ada compiler to interface to Fortran. To
try such an interface if the Ada compiler does not intend to allow it is
of course hazardous at best, and unlikely to work. If pragma Interface 
FORTRAN is available, then of course any reasonable implementation of it
will pass arrays in the Fortran manner (typically passing the address of
the first element, or perhaps the virtual array origin if this is how the
fortran compiler works). 

On the other hand you would neither expect nor want it to make a copy of
the array into column-major form, so you would normally expect, in an Ada 83
context, to have to flip the subscripts on the Ada side, which is an annoyance
but not a disaster (I certainly think it's a reasonable frill to add the
relevant pragma in Ada 9X).

The point here is that the mapping of arrays is not the fundamental issue
in a Fortran binding. If Mike is working with a compiler that tries to
pass array descriptors to a subprogram to which pragma Interface FORTRAN
is applied, then that compiler is broken. If he is working with a compiler
that has no pragma Interface FORTRAN at all, then clearly that is not the
tool to interface Ada and Fortran!

P.S. I keep forgetting, but the name FORTRAN has been officially changed to
Fortran now, very confusing!

^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: QUERY ABOUT MONITOR
@ 1993-08-11  0:05 Michael Feldman
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Feldman @ 1993-08-11  0:05 UTC (permalink / raw)


In article <2489m6$2ht@schonberg.cs.nyu.edu> dewar@cs.nyu.edu (Robert Dewar) wr
ites:
>Mike repeats a common myth about Fortran, namely that it requires arrays to
>be passed by reference. This is rubbish. In fact Ada tried to copy Fortran's
>approach carefully. Both Ada and Fortran allow composite objects to be passed
>by reference or value, as decided by the compiler. Any Fortran code that
>counts on pass by reference is faulty (Mike if you don't believe this, settl
>down with the Fortran standard, it's perfectly clear there).

I'll do this. Good idea.
>
>However, in practice, both in Ada and Fortran, arrays are typically passed by
>reference, so this is from a pragmatic point of view a non-issue.

Right.
>
>All Ada compilers I know of lay out arrays contiguously (interestingly enough
>Mike makes the opposite mistake here, Fortran DOES require arrays to be laid
>out contiguously, it's not an obvious requirement, but it is a ramification
>of the rules for passing arrays in Fortran). So that also is not in practice
>a problem.

OK.
>
>Now what about passing descriptors etc. Well we obviously must have pragma
>Interface FORTRAN available in an Ada compiler to interface to Fortran. To
>try such an interface if the Ada compiler does not intend to allow it is
>of course hazardous at best, and unlikely to work. If pragma Interface 
>FORTRAN is available, then of course any reasonable implementation of it
>will pass arrays in the Fortran manner (typically passing the address of
>the first element, or perhaps the virtual array origin if this is how the
>fortran compiler works). 

Good so far.
>
>On the other hand you would neither expect nor want it to make a copy of
>the array into column-major form, so you would normally expect, in an Ada 83
>context, to have to flip the subscripts on the Ada side, which is an annoyance
>but not a disaster (I certainly think it's a reasonable frill to add the
>relevant pragma in Ada 9X).

Huh? The LRM requires no particular storage mapping, so it's perfectly
legal, indeed innocuous, to store them column major. Then nobody has to
flip. That was JUST my point. Every Ada compiler I know of does it row-
major; except for interfacing, it should make no difference. 

NATURALLY this is implementation-specific, as is any interfacing.
But don't you think it might've been nice for someone to investigate
whether a clean Ada83 Fortran interface in, say, 86-87 would've opened the
market up?  With your obvious acquaintance with the vendors, perhaps
you know whether anyone ever took a serious look at this. If so,
my bedtime snack will be roast crow.

Is it so terrible to expect to find one vendor specializing in 
Fortran-savvy Ada compilers while another specializes in C-savvy ones? 
Instead what we have is a bunch of me-too vanilla Unix compilers for each 
platform; this hurts all of them - all the vendors are fighting for a piece 
of a pie that should be a lot bigger. Also there should be more pies.
>
>The point here is that the mapping of arrays is not the fundamental issue
>in a Fortran binding. If Mike is working with a compiler that tries to
>pass array descriptors to a subprogram to which pragma Interface FORTRAN
>is applied, then that compiler is broken. If he is working with a compiler
>that has no pragma Interface FORTRAN at all, then clearly that is not the
>tool to interface Ada and Fortran!

Exactly. I've seen some compilers with pragma Interface Fortran, but
I'm not aware of any Fortran-savvy enough to make it easy by getting the
array mappings right. As I said, I'll eat crow if I'm mistaken here.
But I've seen a lot of Appendix F's and suchlike, and never seen one.
>
>P.S. I keep forgetting, but the name FORTRAN has been officially changed to
>Fortran now, very confusing!

Simple rule: if it's pronounced as a word (Fortran, Algol, Cobol) we
should forget the all-caps. The names are not trademarked. :-) This
is consistent with radar and snafu.

If it's spelled out verbally (PL/I, APL), cap it like USA or IBM.

Reasonable convention? Some journals use it.

Mike Feldman

^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: QUERY ABOUT MONITOR
@ 1993-08-10  2:01 cis.ohio-state.edu!math.ohio-state.edu!darwin.sura.net!seas.gwu.edu!mfeld
  0 siblings, 0 replies; 6+ messages in thread
From: cis.ohio-state.edu!math.ohio-state.edu!darwin.sura.net!seas.gwu.edu!mfeld @ 1993-08-10  2:01 UTC (permalink / raw)


In article <244m3h$9k@schonberg.cs.nyu.edu> dewar@cs.nyu.edu (Robert Dewar) wri
tes:
>I couldn't tell whether Mike's post was intended to be facetious or not.
>I will assume that it was serious. If not, sorry!
>
>Really! if the only reason you can't reuse Fortran code is array mapping,
>have you ever considered the amazing technique of reversing the order of
>the subscripts in the declaration on the Ada side? That is ALL we are
>talking about. Let's not make mountains out of mole hills here. The feature
>is useful, but not essential, it's just a minor convenience to have the
>compiler do this flipping of subscripts automaticaly.
>
My post was from at least a week ago; I'm sure most folks long since forgot
what it was about. 

On the issue: are we sure that Ada maps arrays in such a way that ONLY
flipping the subscripts will guarantee intelligibility to Fortran?

- Nothing in the LRM, for example, requires that arrays be passed by
  reference, but Fortran does. 

- Nothing requires that they even be contiguous. Fortranners usually 
  assume that arrays are contiguous.

- Nothing requires that, even if an array is passed by value, just
  the data is passed with no "dope vector" or whatever.

Where is the binding to IMSL? If it were as easy as you suggest, 
producing one should have been a piece of cake. I claim it's not
trivial for the user (without a lot of 'ADDRESS-ing), and I claim 
the compiler writers could do it pretty easily. Indeed, the 9x annex
even shows what it might look like. That's nice, but where have we
been for 10 years? Nothing in that (Fortran) annex can't be done 
with Ada83, yet nobody has done it (as far as I know). 

Do you really believe that a clean, no-tricks Fortran interface wouldn't 
get Ada into more egineering shops?

Once again, if the univs. had some sources to start with, they might have
shown the way. Then the vendors could just glom on.

Mike

^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: QUERY ABOUT MONITOR
@ 1993-08-09  5:08 Robert Dewar
  0 siblings, 0 replies; 6+ messages in thread
From: Robert Dewar @ 1993-08-09  5:08 UTC (permalink / raw)


I couldn't tell whether Mike's post was intended to be facetious or not.
I will assume that it was serious. If not, sorry!

Really! if the only reason you can't reuse Fortran code is array mapping,
have you ever considered the amazing technique of reversing the order of
the subscripts in the declaration on the Ada side? That is ALL we are
talking about. Let's not make mountains out of mole hills here. The feature
is useful, but not essential, it's just a minor convenience to have the
compiler do this flipping of subscripts automaticaly.

^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: QUERY ABOUT MONITOR
@ 1993-08-04  2:43 Michael Feldman
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Feldman @ 1993-08-04  2:43 UTC (permalink / raw)


In article <2536.237.uupcb@nitelog.com> michael.hagerty@nitelog.com (Michael Ha
gerty)  writes:
>On Mon, 2 Aug 1993, Michael Feldman posted a response to Jonathan Schilling:
>
>MF. Another example: are there any vendors out there who've tried to go after
>  . a piece of the Fortran-oriented market by mapping its multidimensional
>  . constrained arrays in column-major form? The LRM allows any old storage
>  . mapping. Teachers like me explain this seeming gaffe by pointing out that
>  . a compiler oriented at the Fortran crowd _could_ use column-major
>  . storage to interface with old Fortran codes, 
>
>Boy and do I have a pant-load of well-test old Fortran codes I would like to
>reuse ala "plug and play".  But nooooooo, array mapping is not compatible.
>So I have to lift the hood and thus am forced to translate this stuff to Ada
>for no other reason...  I really like writing Ada, but I do not like figuring
>out someone else's Fortran just so I can translate it to Ada...
>
Wow! And here I thought all my ranting about Fortran was just "academic"
and "theoretical" stuff. :-)

Mike Feldman

^ permalink raw reply	[flat|nested] 6+ messages in thread
* QUERY ABOUT MONITOR
@ 1993-08-02 22:26 cis.ohio-state.edu!math.ohio-state.edu!howland.reston.ans.net!darwin.sura
  0 siblings, 0 replies; 6+ messages in thread
From: cis.ohio-state.edu!math.ohio-state.edu!howland.reston.ans.net!darwin.sura @ 1993-08-02 22:26 UTC (permalink / raw)


On Mon, 2 Aug 1993, Michael Feldman posted a response to Jonathan Schilling:

MF. Another example: are there any vendors out there who've tried to go after
  . a piece of the Fortran-oriented market by mapping its multidimensional
  . constrained arrays in column-major form? The LRM allows any old storage
  . mapping. Teachers like me explain this seeming gaffe by pointing out that
  . a compiler oriented at the Fortran crowd _could_ use column-major
  . storage to interface with old Fortran codes, 

Boy and do I have a pant-load of well-test old Fortran codes I would like to
reuse ala "plug and play".  But nooooooo, array mapping is not compatible.
So I have to lift the hood and thus am forced to translate this stuff to Ada
for no other reason...  I really like writing Ada, but I do not like figuring
out someone else's Fortran just so I can translate it to Ada...

Regards, Mikey <michael.hagerty@nitelog.com>
---
 . MR/2 1.52 #63 . In God we trust; all others pay cash.
                                        

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

end of thread, other threads:[~1993-08-11  0:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-08-10 14:00 QUERY ABOUT MONITOR Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
1993-08-11  0:05 Michael Feldman
1993-08-10  2:01 cis.ohio-state.edu!math.ohio-state.edu!darwin.sura.net!seas.gwu.edu!mfeld
1993-08-09  5:08 Robert Dewar
1993-08-04  2:43 Michael Feldman
1993-08-02 22:26 cis.ohio-state.edu!math.ohio-state.edu!howland.reston.ans.net!darwin.sura

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