New Alpha_(re)

Wed, 2 Apr 1997 00:08:59 +0200 (MET DST)


According to Phil Nelson:
>   Thanks MUCH for all your work on gpc.  You have greatly improved the
> compiler!!  

Thank you!  :-)  My next goal are Schema types ...

But I am sure that there are still bugs in the new features, especially
in the import mechanism.

> I do have a couple of questions about the most recent alpha.
> 
> >  * Field widths now default to left-justified output.
> 
> Did I miss a discussion on this?  Doesn't this break a lot of programs?
> Or is this with "--borland-pascal"?

Perhaps my formulation was misleading:  I mean that

    writeln ( 123 );

will no more yield the output

    _______123

(with seven blanks), but instead

    123

(left-justified).  To produce "_______123" you must explicitly say
"writeln ( 123 : 10 );".

The Standard says that these default widths are implementation-dependent.
There was a short discussion about whether GPC's behavior (default width
10 for Integers, 14 for Reals, 6 for Booleans) was a good decision.
We soon agreed that it would be better to produce left-justified output
when no width has been specified.  Otherwise, you would have to say
"writeln ( 123 : 1 );" to get the left-justified "123" which is clumsy
and misleading.  We forgot to post a copy of the discussion to the list;
sorry about that.

In case you have some arguments to set it back to the previous state,
just post it here.  (These are only some constants in `rts/rts.h', so it
was not much work to change.  Perhaps (yet another) command-line switch
would satisfy everybody?)

> >  * `For' now accepts components of structured variables as control
> >    variables, e.g. "for myarray [ i ]:= 1 to 100 do ...".
> 
> Why?

In short:  Why not?

In long:  Indeed, the standard only allows an entire variable in this
context.  Thank you for pointing me to this; I will make this extension
trigger a warning if `--standard-pascal' or `--extended-pascal' has
been specified.  (With `--pedantic-errors', the warning will be an
error message.)  But Borland Pascal allows this, I got it "for free"
(just changed one line in `gpc-parse.y'), so why not allow it, too?

Greetings,

    Peter

  Dipl.-Phys. Peter Gerwinski, Essen, Germany, free physicist and programmer
peter.gerwinski@uni-essen.de - http://home.pages.de/~peter.gerwinski/ [970201]
       maintainer GNU Pascal - http://home.pages.de/~gnu-pascal/ [970125]


Peter Gerwinski (peter@agnes.dida.physik.uni-essen.de)

HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada - Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es