Protected parameters, 2nd try_(re)

Sun, 9 Mar 1997 14:39:19 +0100 (MET)


According to Berend de Boer:
> There is a few cases where it might be a little bit less hard. I think the case
> when there are no var parameters (so there is no aliasing) protected should be
> protected var.

No chance:

    Var
      x: Integer;

    Procedure Bar ( protected y: Integer );

    begin (* Bar *)
      x:= 3;
    end (* Bar *);

    ...

    Bar ( x );

It needn't be an explicit assignment; it might be a call to a function
which makes the value of `x' change.  To pass everything by value *is*
the only possibility.

But I will modify `Const' parameters to pass small things by value and
to work with implicit temporary variables when a constant is passed as
a `Const' parameter.  Then it's up to the programmer to take care that
the `Const' parameter doesn't change its value due to side effects.

Hmmm ... how to tread `protected Var' parameters???

    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