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 X-Received: by 2002:ac8:26d5:: with SMTP id 21mr4300013qtp.266.1565114165644; Tue, 06 Aug 2019 10:56:05 -0700 (PDT) X-Received: by 2002:a9d:6c13:: with SMTP id f19mr4048136otq.76.1565114165415; Tue, 06 Aug 2019 10:56:05 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!b26no6763638qtq.0!news-out.google.com!e17ni2774qtg.1!nntp.google.com!b26no6763637qtq.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 6 Aug 2019 10:56:05 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=47.185.223.245; posting-account=zwxLlwoAAAChLBU7oraRzNDnqQYkYbpo NNTP-Posting-Host: 47.185.223.245 References: <01e1fc91-a20e-4b48-a10e-57d3935cd06c@googlegroups.com> <0d4e46d4-c227-4d7a-aafa-44492c6e1d41@googlegroups.com> <871ryop74h.fsf@nightsong.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Microsoft is considering moving to Rust; potential opportunity for Ada2020 From: Optikos Injection-Date: Tue, 06 Aug 2019 17:56:05 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader01.eternal-september.org comp.lang.ada:56999 Date: 2019-08-06T10:56:05-07:00 List-Id: On Tuesday, August 6, 2019 at 12:01:14 PM UTC-5, Alejandro R. Mosteo wrote: > On 20/7/19 0:07, Simon Wright wrote: > > Paul Rubin writes: > >=20 > >> Optikos writes: > >>> Yes, I also was wondering why Microsoft isn't fervently exploring > >>> adding a Rust-esque borrow checker to C# > >> > >> C# is garbage collected, I thought. No need for anything like a > >> borrow checker. > >=20 > > GC is about safely disposing of memory that's no longer accessible from > > anywhere in the program. > >=20 > > Borrow checking (AIUI) is about making sure that only one part of the > > program has write access to a particular piece of memory at once. >=20 > Yes and no. If you check the first chapters in the Rust tutorial, heap=20 > memory reclamation is also performed deterministically when the borrow=20 > checker determines some memory has no more references left pointing to it= . >=20 > I've seen it described as static GC. I guess it's a side-effect of the=20 > borrow checker; if you have to know how many mutable/immutable references= =20 > exist to a block of memory, you end knowing when none are left. I suspect that each commenter prior to Alejandro Mosteo had their own varia= nt definition of garbage collection. Some people think garbage collection = is limited to mark-&-sweep garbage collection, excluding reference counting= . Other people designate that definition as AGC (automatic garbage collect= ion) and also include reference counting in the generic term garbage collec= tion (without the automatic on the front). Alejandro is correct: if a tec= hnique can assure that the mutable count is not greater than one, then the = technique has enough wherewithal to know when the mutable + immutable count= goes less than 1 (i.e., zero) to release the resource via reference counti= ng. Although, how does Rust's borrow checker assure the lack of cycles (or= assure that the cyclic references are self-contained in a glob that itself= has an acyclic reference count, so that the entire glob is condemned en ma= sse)? How much of a borrow-checker-esque approach is going to appear in Ad= a202X, especially now that the timeline is extended? The book _Garbage collection: Algorithms for automatic dynamic memory mana= gement_ presents both of these variant definitions (and more shade-of-meani= ng flavors too). https://www.worldcat.org/title/garbage-collection-algorithms-for-automatic-= dynamic-memory-management/oclc/301048851 > That's my superficial understanding (haven't done any serious Rust). I'm= =20 > frankly impressed by the concept. It seems to be a real contribution to= =20 > the general landscape. Too bad the syntax gets ugly pretty quickly; I=20 > wonder about long-term maintainability. >=20 > Also, the particular interest of Microsoft in Rust is clear to me; it=20 > precludes whole classes of memory errors that make for a big chunk of=20 > security vulnerabilities.