From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.bbs-scene.org!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!69.16.185.16.MISMATCH!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!fx02.iad.POSTED!not-for-mail From: David Thompson Newsgroups: comp.lang.ada Subject: Re: GNAT GPL is proving...educational Organization: Poor Message-ID: References: X-Newsreader: Forte Agent 3.3/32.846 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@teranews.com NNTP-Posting-Date: Wed, 31 Jul 2013 02:02:31 UTC Date: Tue, 30 Jul 2013 22:02:38 -0400 X-Received-Bytes: 3185 Xref: news.eternal-september.org comp.lang.ada:16612 Date: 2013-07-30T22:02:38-04:00 List-Id: On Mon, 22 Jul 2013 10:18:21 +0300, Niklas Holsti 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.