Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!spool2.mu.edu!sdd.hp.com!elroy.jpl.nasa.gov!decwrl!infopiz!lupine!rfg From: rfg@NCD.COM (Ron Guilmette) Newsgroups: comp.lang.c++ Subject: Re: Smart Pointers -- A proposed language extension Message-ID: <3452@lupine.NCD.COM> Date: 23 Jan 91 09:18:28 GMT References: <1991Jan18.230221.707@cpsc.ucalgary.ca> <6290@exodus.Eng.Sun.COM> Organization: Network Computing Devices, Inc., Mt. View, CA Lines: 46 In article tom@ssd.csd.harris.com (Tom Horsley) writes: +Just to throw some more dust around the smart pointer issue :-) + +It seems to me that what the "smart pointer" proposals all boil down to is a +request for language support to prevent programmers from using something +"improperly". I believe the general consensus throughout this discussion has +been that garbage collection and smart pointers are possible now, but to use +them effectively you have to employ somewhat restrictive coding standards +which are easy to unintentionally violate. Gee! At least one person caught my drift. :-) +Given this, could the smart pointer question be considered an "environment" +issue rather than a "language" issue? Could a sufficiently sophisticated C++ +development environment provide the sort of additional semantic checks +needed to insure that no one ever used a class "improperly"? I want to refute this as strongly as possible. NO!!! This has nothing to do with environments! Type-checking is one way that the compiler can restrict you from shooting yourself in the foot. Is type-checking an environment issue? NO WAY! +... Without multi-threading I don't +believe there are any problems... Except for those darn dumb pointers! +...GC in a single thread environment is always +triggered by some sort of subroutine call, and no self-respecting compiler +will keep something alive in a temporary across a routine call when that +value might be aliased by the routine call. Right. "Synchronous" garbage collection (triggered by a function call) is a LOT easier than BIG TIME "asynchronous" garbage collection (or garbage collection which gets performed by other threads, which amounts to the same thing). I realize that the latter problem is more entertaining (and perhaps even of more practical value) but right now, I'll settle for a "safe" way to do the former. -- // Ron Guilmette - C++ Entomologist // Internet: rfg@ncd.com uucp: ...uunet!lupine!rfg // Motto: If it sticks, force it. If it breaks, it needed replacing anyway.