Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #3189

Re: What attributes of a programming language simplify its implementation?

From gah4 <gah4@u.washington.edu>
Newsgroups comp.compilers
Subject Re: What attributes of a programming language simplify its implementation?
Date 2022-10-03 12:28 -0700
Organization Compilers Central
Message-ID <22-10-017@comp.compilers> (permalink)
References <22-09-026@comp.compilers> <22-10-002@comp.compilers> <22-10-004@comp.compilers> <22-10-012@comp.compilers> <22-10-014@comp.compilers>

Show all headers | View raw


On Monday, October 3, 2022 at 11:15:17 AM UTC-7, rob...@dodo.com.au wrote:

(snip on some use of PL/I)

> Yes, STRINGSIZE,** like STRINGRANGE***, SUBSCRIPTRANGE, SIZE,
> FIXEDOVERFLOW*, etc
> are not enabled by default.
> Originally, these were not enabled because it took extra instructions
> to implement the test on S/360.

(and our moderator wrote)

> [I agree that adding two numbers and getting three spaces was bad
> practice, and there were ways to avoid shooting yourself in the foot.
> My point was that there were situations where each individual step was
> reasonable, but the combination was absurd. Those are hard to
> completely avoid. PL/I had a lot of them for entirely understandable
> reasons. That didn't mean it was a hard language, rather that you
> had to understand what you were doing. -John]

The reason for mentioning PL/I was because, in comparing to Fortran
it is easy to see where Fortran was designed for ease of implementation
(even though the designers will disagree), and PL/I for ease of use
(even though it is easy to find counterexamples.)

PL/I, in all the places where it makes any sense, allows for the
completely general form of expression.  To do that, it allows for
some conversions which give surprising results.

Fortran instead restricts you from doing things that make
sense, to stop you from doing things that don't.

In the case of ENTRY (a rare language feature by now),
Fortran EQUIVALENCEs the different return values, where
PL/I allows for the appropriate conversion.

PL/I has (only) generic intrinsic functions.  You can give any data
type, including CHAR, to SQRT.  Fortran added generic intrinsic
functions in Fortran 77, though not quite completely.  Yet you still
can't use SQRT on an integer type.  It can't be that hard to
implement the conversion to floating point, but it might cause
other changes to the language.

In Fortran 77, they added the ability to use floating point data
type in DO loops. In Fortran 90, they removed that ability.
It can't be all that hard to implement, and there are problems
in using it, but they aren't all that bad.

Since PL/I allows the same type of expression everywhere, compilers
only need to implement it once.  Fortran has complicated rules on
what kind of expression you can use where.  Even though it
simplifies each one, compilers have to implement them all, and
use each one in the right place.  Users have a hard time
remembering which one goes where.

In the end, Fortran rules meant to simplify the implementation
actually make it harder.

Back to comp.compilers | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

What attributes of a programming language simplify its implementation? Christopher F Clark <christopher.f.clark@compiler-resources.com> - 2022-09-30 12:46 +0100
  Re: What attributes of a programming language simplify its implementation? Martin Ward <martin@gkc.org.uk> - 2022-10-01 15:56 +0100
    Re: What attributes of a programming language simplify its implementation? gah4 <gah4@u.washington.edu> - 2022-10-01 17:05 -0700
      Re: What attributes of a programming language simplify its implementation? gah4 <gah4@u.washington.edu> - 2022-10-02 00:11 -0700
      Re: What attributes of a programming language simplify its implementation? "Robin Vowels" <robin51@dodo.com.au> - 2022-10-03 12:34 +1100
        Re: What attributes of a programming language simplify its implementation? robin51@dodo.com.au - 2022-10-03 15:59 +1100
          Re: What attributes of a programming language simplify its implementation? gah4 <gah4@u.washington.edu> - 2022-10-03 12:28 -0700
    Re: What attributes of a programming language simplify its implementation? Christopher F Clark <christopher.f.clark@compiler-resources.com> - 2022-10-02 01:21 +0100
  Re: What attributes of a programming language simplify its implementation? Thomas Koenig <tkoenig@netcologne.de> - 2022-10-08 22:44 +0000
    Re: What attributes of a programming language simplify its implementation? "minf...@arcor.de" <minforth@arcor.de> - 2022-11-14 05:14 -0800
      Re: What attributes of a programming language simplify its implementation? gah4 <gah4@u.washington.edu> - 2022-11-15 06:09 -0800
    RE: Re: What attributes of a programming language simplify its implementation? Roger L Costello <costello@mitre.org> - 2022-11-15 11:52 +0000
      Re: Re: What attributes of a programming language simplify its implementation? <minforth@arcor.de> - 2022-11-15 09:48 -0800
        Re: Re: What attributes of a programming language simplify its implementation? RPN? gah4 <gah4@u.washington.edu> - 2022-11-15 16:11 -0800
          Re: Re: What attributes of a programming language simplify its implementation? RPN? "minf...@arcor.de" <minforth@arcor.de> - 2022-11-16 04:54 -0800
            Re: Re: What attributes of a programming language simplify its implementation? RPN? "minf...@arcor.de" <minforth@arcor.de> - 2022-11-16 05:39 -0800
          Re: Re: What attributes of a programming language simplify its implementation? RPN? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2022-11-16 18:12 +0000

csiph-web