🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #2140

Re: Oberon vs Modula-2 vs Modula-3

#2140
From: Peter Klein
Date: Sun, 22 Nov 1992 18:55
36 lines
2030 bytes
In article 338@jyu.fi, sakkinen@jyu.fi (Markku Sakkinen) writes:
>A good point, showing that my suggestion of constant vs. variable
>is worse that value vs. variable as far as regards aliassing problems.
>Thus, there would indeed be some merit in having three parameter modes
>(as somebody suggested in this thread):
>value, constant, and variable

This is exactly what Modula-3 has: VAL, READONLY and VAR.

In article 18702@informatik.uni-ulm.de, borchert@titania.mathematik.uni-ulm.de (Andreas Borchert) writes:

>Readonly parameters don't protect from surprises. E.g. if we have
>the above mentioned
>
>   PROCEDURE p(a: Type; READONLY b: Type);
>   BEGIN
>      a[1] := ....;
>      (* has b[1] been changed now? *)
>   END;
>
>where p is called as p(x, x). And all other cases are still not solved
>where formerly VAR-parameters have been threatened by other procedures
>in a non-obvious way.

What is surprising about this? The semantics of the example is obvious
(at least in Modula-3). b[1] is not changed, of course. a is passed by
value, so the global x (and therefore b) is not changed by the assignment.

Peter
---
Peter Klein                        E-Mail: pk@rwthi3.informatik.rwth-aachen.de
Lehrstuhl fuer Informatik III      Tel.: +49/241/80-21320
Ahornstrasse 55                    Fax.: +49/241/80-21329
RWTH Aachen
D-5100 Aachen
Germany
Technical Details
Message-ID: <1992Nov22.185530.26542@Urmel.Informatik.RWTH-Aachen.DE>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!Sirius.dfn.de!Urmel.Informatik.RWTH-Aachen.DE!schumann!pk
References: <1992Nov19.140913.18702@informatik.uni-ulm.de>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.modula2
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!Sirius.dfn.de!Urmel.Informatik.RWTH-Aachen.DE!schumann!pk
From: pk@rwthi3.informatik.rwth-aachen.de (Peter Klein)
Subject: Re: Oberon vs Modula-2 vs Modula-3
Message-ID: <1992Nov22.185530.26542@Urmel.Informatik.RWTH-Aachen.DE>
Sender: news@Urmel.Informatik.RWTH-Aachen.DE (Newsfiles Owner)
Nntp-Posting-Host: schumann
Reply-To: pk@rwthi3.informatik.rwth-aachen.de
Organization: Lehrstuhl fuer Informatik III, RWTH Aachen, Germany
References: <1992Nov19.140913.18702@informatik.uni-ulm.de>
Date: Sun, 22 Nov 92 18:55:30 GMT
Lines: 37