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.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: How to get Ada to ?cross the chasm?? Date: Fri, 11 May 2018 14:06:41 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <1c73f159-eae4-4ae7-a348-03964b007197@googlegroups.com> <87zi1gz3kl.fsf@nightsong.com> <878t8x7k1j.fsf@nightsong.com> <87k1sg2qux.fsf@nightsong.com> <87h8njmk4r.fsf@nightsong.com> <87po27fbv9.fsf@nightsong.com> <87h8nhwhef.fsf@nightsong.com> <87d0y4zf7d.fsf@nightsong.com> <871sejyp8d.fsf@nightsong.com> NNTP-Posting-Host: MyFhHs417jM9AgzRpXn7yg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 X-Notice: Filtered by postfilter v. 0.8.3 Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:52265 Date: 2018-05-11T14:06:41+02:00 List-Id: On 11/05/2018 12:57, Niklas Holsti wrote: > On 18-05-11 13:04 , Dmitry A. Kazakov wrote: >> On 11/05/2018 03:07, Paul Rubin wrote: > >    [snip] > >>> That's in contrast with >>> conservative GC where the runtime can't necessarily figure out the types >>> of all the objects.  Conservative GC is a terrifying concept in theory, >>> but it works surprisingly well in practice.  It has been used in Ada in >>> the past. >> >> [snip] And even with statically known types the >> pointers might be not statically known: >> >>    type My_Integer (Indirect : Boolean := False) is record >>       case Indirect is >>          when True => >>             Reference : access Integer; >>          when False => >>             Value : Integer; >>       end case; >>    end My_Integer; > > That would not bother a conservative GC much; it would use the record's > contents as potential pointers (to whatever type of object) without > caring about the value of the Indirect discriminant. > > If Indirect = False, but the Value happens to be a valid pointer to or > into a heap object, the conservative GC would consider the heap object > "reachable" and refrain from collecting it. So collection would not find > all the garbage, but usually it would find most of it. Yes, but if we start not collecting objects we could do just same without pointers. The compiler could allocate Reference for each instance of My_Integer and never free it. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de