From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,924aad49bcf9e4e7 X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Cumbersome Polymorphism Date: 1997/01/25 Message-ID: #1/1 X-Deja-AN: 212134550 references: <32E7ABE8.3BF3@eurocontrol.fr> <5c9put$48t@hetre.wanadoo.fr> organization: The World Public Access UNIX, Brookline, MA newsgroups: comp.lang.ada Date: 1997-01-25T00:00:00+00:00 List-Id: In article <5c9put$48t@hetre.wanadoo.fr>, J-P. Rosen wrote: >Richard Irvine 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