comp.lang.ada
 help / color / mirror / Atom feed
From: Jere <jhb.chat@gmail.com>
Subject: Re: Why not Coq2Ada program extraction?
Date: Tue, 1 May 2018 04:44:58 -0700 (PDT)
Date: 2018-05-01T04:44:58-07:00	[thread overview]
Message-ID: <2da6c10e-0af9-4d28-a869-950d34495e1b@googlegroups.com> (raw)
In-Reply-To: <87efiwm3er.fsf@nightsong.com>

On Tuesday, May 1, 2018 at 12:00:00 AM UTC-4, Paul Rubin wrote:
> "Dan'l Miller" writes:
> > Why hasn't anyone ever developed Ada extraction from Coq proofs?
> On the other hand, there's a C++11 back end for Purescript (purescript.org)
> that uses std::shared_ptr as a poor person's GC, so maybe Rust has
> something like that too.
> 

You generally don't use any direct allocation or deallocation in Rust.  If
you need heap memory, you use something like Box<Element_Type> (like 
std::unique_ptr), Rc<Element_Type> (like std::shared_ptr), or 
Arc<Element_Type> (a thread safe version of Rc).  You generally don't use
pointers, but rely on references (which are always non-null and cannot be
deallocated).  Everything tries to be stack allocated if possible.  One of
the more confusing things that caught me was I kept seeing the use of 
SomeType::new() everywhere and assumed it was heap allocation.  It actually
rarely was heap allocation at all.  Also keep in mind that rust is actually
considered two different languages "safe rust" and "unsafe rust", which is
analogous to Ada's "unchecked" options.  You have to be explicit to use
unsafe rust and I believe there are language options to prohibit it's use
in your own code (I'd have to check to make sure on that though).  Pointers
are always "unsafe" so you cannot use them in Rust code without using
explicitly "unsafe Rust" code.  It is also very extremely picky about
how you use references.  You can only have either 1 mutable reference OR
up to N immutable references (never both).  It is all compile time checked
and the compiler is EXTREMELY picky (way more so than an Ada compiler is).


  parent reply	other threads:[~2018-05-01 11:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-01  3:38 Why not Coq2Ada program extraction? Dan'l Miller
2018-05-01  3:59 ` Paul Rubin
2018-05-01  6:59   ` Chris M Moore
2018-05-01  7:41     ` Paul Rubin
2018-05-01 11:44   ` Jere [this message]
2018-05-02 16:47   ` G.B.
2018-05-02 17:12     ` Paul Rubin
2018-05-01  8:21 ` Jeffrey R. Carter
2018-05-01 17:30   ` Dan'l Miller
2018-05-01  9:12 ` Paul Rubin
2018-05-07  2:30 ` Dan'l Miller
2018-05-07  2:37   ` Paul Rubin
2018-05-07  3:50     ` Dan'l Miller
2018-05-07  4:01     ` Dan'l Miller
2018-05-07  4:20       ` Paul Rubin
2018-05-07 16:33         ` Dan'l Miller
2018-05-07 13:27   ` Dan'l Miller
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox