comp.lang.ada
 help / color / mirror / Atom feed
From: agate!howland.reston.ans.net!math.ohio-state.edu!darwin.sura.net!seas.gwu .edu!mfeldman@ucbvax.Berkeley.EDU  (Michael Feldman)
Subject: Re: QUERY ABOUT MONITOR
Date: 11 Aug 93 00:05:27 GMT	[thread overview]
Message-ID: <1993Aug11.000527.5174@seas.gwu.edu> (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

             reply	other threads:[~1993-08-11  0:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-08-11  0:05 Michael Feldman [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-08-10 14:00 QUERY ABOUT MONITOR Robert Dewar
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
replies disabled

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