comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: Cumbersome Polymorphism
Date: 1997/01/25
Date: 1997-01-25T00:00:00+00:00	[thread overview]
Message-ID: <E4KKqz.CJM@world.std.com> (raw)
In-Reply-To: 5c9put$48t@hetre.wanadoo.fr


In article <5c9put$48t@hetre.wanadoo.fr>,
J-P. Rosen <Rosen.Adalog@wanadoo.fr> wrote:
>Richard Irvine <irv@eurocontrol.fr> wrote:
>>Before using Ada I used Smalltalk.
>>A Smalltalk variable can hold an instance of any class.
>>Of course, this is possible because a Smalltalk variable is just 
>>a pointer to dynamically allocated storage.
>>The important point though is that the pointers and the problems of 
>>allocation and deallocation are hidden from the Smalltalk programmer,
>>while the Ada programmer is obliged to be (painfully) aware of them 
>>much of the time.

The problems of allocation and deallocation are hidden from the
Smalltalk programmer (and from the Ada programmer, if you can find a
garbage-collected implementation of Ada, which isn't easy).  But the
pointers are not hidden in either language: The fundamental thing that
makes a pointer a pointer is that two pointers can point at the same
thing.  This is what makes pointers useful.  And this happens in both
languages, despite the fact that dereferencing the pointer is always
implicit in Smalltalk.  In Ada, you are forced to use a pointer if you
have something that changes size, and this is indeed unfortunate from
the functionality point of view.  In Smalltalk, you are forced to use a
pointer ALWAYS, and IMHO that's even more unfortunate.

Note that in Ada, if you have to use a pointer for low-level
implemenation reasons, like the fact that the thing changes size, you
can hide this fact from clients.  You can't do that in Smalltalk, if I
remember correctly, since assignment in Smalltalk is always allowed, and
always means "copy the pointer" -- there's no simple way of preventing
the client from evilly making aliases.

- Bob




  parent reply	other threads:[~1997-01-25  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-01-23  0:00 Cumbersome Polymorphism Richard Irvine
1997-01-27  0:00 ` Norman H. Cohen
1997-01-28  0:00   ` Richard Irvine
1997-01-28  0:00   ` Jon S Anthony
1997-01-28  0:00   ` Dave Gibson
     [not found] ` <5c9put$48t@hetre.wanadoo.fr>
1997-01-25  0:00   ` Robert A Duff [this message]
1997-01-25  0:00     ` James O'Connor
1997-01-26  0:00       ` Robert Dewar
1997-01-26  0:00       ` Brian Rogoff
1997-01-25  0:00   ` James O'Connor
1997-01-27  0:00   ` Jon S Anthony
1997-01-29  0:00     ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox