Main Program Name decapitalization

Sun, 20 Oct 1996 19:09:46 +0100 (MET)


Hi everybody,

I was reported several errors resulting from the decapitalization
of the main program's name, e.g. 

    Program Log;

    begin
      writeln ( ln ( 2.7184 ) );
    end.

crashed because the program's name was decapitalized, i.e. "Log" was
mapped to "log" which did hide the function in libm.a ...

One could think about letting the program name like it is, say "Log".
But (as Juki writes in gpc-util.c :-) the standard says that the
program's name has to go into a separate name space i.e. mustn't be
visible inside the program's declaration part and body.

I solved the problem by mapping "Name" to "program_Name" instead of
"name".  But this is not the end of the story.

Borland Pascal defines so-called qualified identifiers:

    Program Foo;

    Function writeln: Real;

    begin (* writeln *)
      writeln:= 2.7184;
    end (* writeln *);

    begin
      System.writeln ( Foo.writeln );
    end.

So the program's name *must* go into its declaration part and body --
and we have a classical tragedy.

How to proceed?  I think Borland Pascal's qualified identifiers are 
important and must be implemented, one day.  Introduce another
command line switch?

My own suggestion follows. ;-)

We should "clean up" Pascal standards in the future by making the
(existing) command line switches to force one standard:

    --standard-pascal
    --extended-pascal
    --borland-pascal
    ...

Without any switch, GPC will try to support *all* standards and warn
about misuse (e.g. Borland's typed constants as initialized variables).
The default for this case would be to *have* qualified identifiers (i.e.
"Program Log" would yield "Log", not "log" and not "program_Log"); with
"--standard-pascal" or "--extended-pascal" it would separate the
program's name from the rest of the world (and create "program_Log").

Yours,

    Peter

      e-mail:  peter.gerwinski@uni-essen.de
home address:  D\"usseldorfer Str. 35, 45145 Essen, Germany
         WWW:  http://agnes.dida.physik.uni-essen.de/~peter/


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