Article View: comp.lang.misc
Article #3847Re: Pointers
From: Markku Sakkinen
Date: Tue, 17 Nov 1992 09:59
Date: Tue, 17 Nov 1992 09:59
60 lines
3337 bytes
3337 bytes
In article <1992Nov13.102813.9215@rdg.dec.com> jch@rdg.dec.com (John Haxby) writes:
>In article <1992Nov12.141532.16375@jyu.fi>, sakkinen@jyu.fi (Markku Sakkinen) writes:
>
>|> [ ... ] I cannot see any semantic
>|> difference between CLU variables (of non-atomic types) and reference
>|> (or pointer) variables in many other languages. 'By sharing' is
>|> exactly the same as 'by reference'.
>
>In CLU, x in
>
> p1 = proc (x: int) ... end p1
>and
> p2 = proc (x: string) ... end p2
>
>is passed by sharing. In the VAX implementation, the p1 has its
>argument passed by value, the second by reference (in the grubby
>depths). In the PCLU implementation, both procedure calls pass
>a CLUREF structure (by value) which contains the value of an integer
>or a pointer to string data. `By sharing' allows the implementation of
>the compiler to choose the mechanism for passing the parameter to
>a procedure, the only requirement is that changing the contents of a
^^^^^^^^^^^^^^^^^^^^^^^^^^
>mutable argument is reflected in all instances of the argument.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
>Don't mix implementation strategies with language semantics.
Sorry, but seems like you are discussing implementation strategies,
not I. The marked quote above says that the semantic effect is _as if_
the parameter were passed by reference; I couldn't care less how
a particular compiler actually implements it. (I have just pointed
out in another thread, in comp.lang.modula2, that by-value and
by-reference are equivalent for immutable parameters, so we have
no argument about that.)
I would say that LISP, CLU etc. are _not_ simpler than Pascal, Ada etc.
because they have no explicit pointers -- but they are simpler because
they have essentially _only_ pointers. There are no value assignments
for complex objects, as a primitive language feature.
The drawback of that simplicity is that you get a lot of potential
aliassing problems, which would not be necessary in those languages
in which value semantics is available. In a fashion, C and its derivatives
have the worst of both worlds. On one hand, you must explicitly take care
of pointers. On the other hand, value semantics isn't applicable to arrays.
(Jim Giles has posted sufficiently about the drawbacks of C arrays,
so I need not repeat any of that.)
Well, I think I have beaten this subject to death for my part.
Sorry for boring the audience.
----------------------------------------------------------------------
Markku Sakkinen (sakkinen@jytko.jyu.fi)
SAKKINEN@FINJYU.bitnet (alternative network address)
Department of Computer Science and Information Systems
University of Jyvaskyla (a's with umlauts)
PL 35
SF-40351 Jyvaskyla (umlauts again)
Finland
----------------------------------------------------------------------
Technical Details
Message-ID:
<1992Nov17.095955.20897@jyu.fi>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!news.funet.fi!network.jyu.fi!sakkinenReferences:
<1992Nov12.103513.14043@rdg.dec.com> <1992Nov12.141532.16375@jyu.fi> <1992Nov13.102813.9215@rdg.dec.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.misc Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!news.funet.fi!network.jyu.fi!sakkinen From: sakkinen@jyu.fi (Markku Sakkinen) Subject: Re: Pointers Message-ID: <1992Nov17.095955.20897@jyu.fi> Organization: University of Jyvaskyla, Finland References: <1992Nov12.103513.14043@rdg.dec.com> <1992Nov12.141532.16375@jyu.fi> <1992Nov13.102813.9215@rdg.dec.com> Date: Tue, 17 Nov 1992 09:59:55 GMT Lines: 60