Certainly.------ Original message------From: Zhiqiang RenDate: Mon, Apr 4, 2016 3:02 PMTo: ats-lang-users;Subject:Re: How to make use of a reference to a linear value?
Is it possible to put a different (linear) proof back into the vbox?
On Wednesday, May 20, 2015 at 12:19:39 AM UTC-4, gmhwxi wrote:‘vbox’ is a keyword.
vbox(pf) is a prop; it indicates that the (linear) proof pf is stored in
a “box”; this proof can be taken out temporarily and the type system
ensures that any proof taken out of a vbox must be returned.
On Tuesday, October 15, 2013 at 2:22:24 PM UTC-4, gmhwxi wrote:
Let VT be a linear type.
Assume that r is a reference of the type ref(VT).
We cannot do !r to dereference r for a very simple reason:
If !r returns a linear value, then what is left at location that
r points to? This is exactly the reasoning behind the saying:
You cannot have the cake and eat it.
Isn’t linear logic interesting
How can we then use the value to which r points? The following
code demonstrate a common way to do it:
(* ****** ****** *)
absvtype VT
(* ****** ****** *)
extern
fun foo (x: &VT): void // [foo] does processing in-situ.
(* ****** ****** *)
extern
fun foo2 (r: ref(VT)): void
implement foo2 ® =
{
val (vbox pf | p) = ref_get_viewptr ®
val () = $effmask_ref (foo (!p)) // [vbox] does not like the ref-effect!
}
You received this message because you are subscribed to the Google Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/b566b06b-6c28-4317-ac69-2b9d3d8eaf06%40googlegroups.com.