Newsgroups: comp.object,comp.lang.c++,comp.lang.ada,comp.lang.clos
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!news.mathworks.com!news.kei.com!world!bobduff
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: C++ not OOP? (Was: Language Efficiency
Message-ID: <D9D3Mt.JJH@world.std.com>
Organization: The World Public Access UNIX, Brookline, MA
References: <dewar.797512974@gnat> <1995May26.104502@lglsun.epfl.ch> <3q4q00$j8u@wcap.centerline.com> <3qcp3q$1gtf@watnews1.watson.ibm.com>
Date: Mon, 29 May 1995 22:54:29 GMT
Lines: 34
Xref: glinda.oz.cs.cmu.edu comp.object:31707 comp.lang.c++:130702 comp.lang.ada:30549 comp.lang.clos:3053

In article <3qcp3q$1gtf@watnews1.watson.ibm.com>,
John Barton <jjb@watson.ibm.com> wrote:
>In article <3q4q00$j8u@wcap.centerline.com>, chase@centerline.com (David Chase) writes:
>[...]
>|> 
>|> With a static type system but no garbage collection (and programmer-
>|> controlled memory allocation instead), how can you know if a given
>|> object supports a certain behavior?
>|> 
>|>   T * p = new T;
>|>   black_box();
>|>   // p might not point to a T at this point -- suppose some global
>|>   // q references a previously freed thing, and the referent of q is
>|>   // modified by black_box, and p was reallocated to use that same
>|>   // memory.  Without garbage collection, your static type system
>|>   // is a joke.
>|> 
>
>   Are you just saying that black_box() might subvert the type-system?

I think he's saying that black_box might do a free operation on p, or
some copy of p, thus leaving p pointing at who-knows-what.  Yes, that
subverts the type system, but you don't have much choice unless you have
garbage collection.

I don't think this makes the static type system a "joke", though.  Sure,
this is a nasty hole in the type system, but that doesn't necessarily
make the type system totally useless.  Besides, g.c. is a separate issue
from static typing -- you can have one or the other or both or neither.
So you can't use the lack of g.c. as an argument against static typing
in general -- just as an argument against a particular language that has
one but not the other.

- Bob
