comp.lang.ada
 help / color / mirror / Atom feed
From: David Thompson <dave.thompson2@verizon.net>
Subject: Re: GNAT GPL is proving...educational
Date: Tue, 30 Jul 2013 22:02:38 -0400
Date: 2013-07-30T22:02:38-04:00	[thread overview]
Message-ID: <htrgv8562kt6v2mpvuqrngk0a30088u394@4ax.com> (raw)
In-Reply-To: b544luFcgc4U1@mid.individual.net

<OT>
On Mon, 22 Jul 2013 10:18:21 +0300, Niklas Holsti
<niklas.holsti@tidorum.invalid> wrote:

> > Coming from a background that involved FORTRAN and some basic-level
> > Java6, there's a definite learning curve.
> 
> Understandable. Original Fortran had no formal separation of
> specification and implementation, and Java unfortunately puts both in
> the same file, as I understand it.

Fortran mostly still doesn't. 

Early Fortran requires you to declare the return type of a used
function iff it differs from that determined by the implicit rules 
(by default first char of name I-M is integer and anything else is
single-precision real); in some cases you must declare that a used
function or subroutine (=procedure) is a subprogram as opposed to a
variable but usually that's implicit; and there is no way to declare
the types of its formals (which Fortran calls dummy arguments and uses
the term parameter for something different).

Fortran>=90 adds the idea of an 'explicit interface' required if a
function return type or subprogram argument type uses any new F>=90
feature, and allowed for 'legacy' ones. But this terminology can be
misleading; in most cases you DON'T write an explicit interface. Any
subprogram implemented in a 'module' (similar to an Ada package), or
'contained' (nested) within another subprogram (allowed to one level
only), automatically gets an explicit interface which you MUST NOT
write. For the former you must have previously compiled the referenced
module and the compiler gets the spec from that. Only for an
'external' subprogram can you write an 'interface block' which spells
out the spec.

Java similarly but more consistently ALWAYS uses the implementation as
the specification -- not just the same file but the exact same tokens.
When you compile several classes together the compiler parses all of
them and extracts their specs. If you compile separately, the
'outside' classes you use must have been previously compiled, and the
compiler gets specs from their .class files, either as separate files
or in a 'jar' which is really just a ZIP; this includes the Java
standard library classes in several JRE-supplied jars.

Yes, both of these can produce makefile hell even worse than C.
Although for Java if you change (and compile) a referenced class's
spec and fail to recompile the referencers, Java does guarantee to
catch the discrepancy, pretty close to Ada's consistency rule.
Fortran like C and others makes this unbounded error.

  parent reply	other threads:[~2013-07-31  2:02 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-22  1:28 GNAT GPL is proving...educational Alan Jump
2013-07-22  3:26 ` Jeffrey Carter
2013-07-22  3:50   ` Alan Jump
2013-07-22  5:11     ` Jeffrey Carter
2013-07-22 22:19       ` Shark8
2013-07-22  5:28     ` Bill Findlay
2013-07-22  8:49       ` Georg Bauhaus
2013-07-22  9:04         ` Bill Findlay
2013-08-01 15:07     ` Stephen Leake
2013-08-01 19:28       ` Alan Jump
2013-07-25  5:41   ` Yannick Duchêne (Hibou57)
2013-07-25 20:25     ` J-P. Rosen
2013-07-25 23:07       ` Yannick Duchêne (Hibou57)
2013-07-22  7:18 ` Niklas Holsti
2013-07-22  8:52   ` Simon Wright
2013-07-31  2:02   ` David Thompson [this message]
2013-07-22 18:28 ` Yannick Duchêne (Hibou57)
2013-07-22 19:04   ` Alan Jump
2013-07-22 19:49     ` Ludovic Brenta
2013-07-22 19:51     ` Simon Wright
2013-07-22 20:12     ` Jeffrey Carter
2013-07-22 23:34     ` Adam Beneschan
2013-07-23  3:46       ` Shark8
2013-07-23 17:46         ` Yannick Duchêne (Hibou57)
2013-07-27  3:17       ` Randy Brukardt
2013-07-29 17:21         ` Alan Jump
2013-07-29 20:57           ` Shark8
2013-07-29 21:30             ` Adam Beneschan
2013-07-29 21:44               ` Alan Jump
2013-07-29 22:36                 ` Yannick Duchêne (Hibou57)
replies disabled

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