var, val, and linear closure

35 views
Skip to first unread message

Steinway Wu

unread,
Jul 11, 2018, 10:10:27 PM7/11/18
to ats-lan...@googlegroups.com
Hi, 

I recently encountered a problem that is potentially related to variables and linear closures. What seems to solve the problem is the third line

var sock: socket_struct
... (* initialize sock using some extfcall *)
val sock
= sock
... (* use sock in a linear closure *)

So my question is, what exactly happens when we write the following line?

val sock = sock

I'm still not clear what's the problem. Please pardon me for not being able to write the question any clearer. 

Thanks,

Hongwei Xi

unread,
Jul 11, 2018, 11:22:44 PM7/11/18
to ats-lan...@googlegroups.com
The following line introduce the name 'sock' for the content
stored in the original variable 'sock':

val sock = sock

Currently, ATS only allows linear values (not variables) to be referred to
in the body of a closure-function.

On Wed, Jul 11, 2018 at 10:10 PM, Steinway Wu <stein...@gmail.com> wrote:
Hi, 

I recently encountered a problem that is potentially related to variables and linear closures. What seems to solve the problem is the third line

var sock: socket_struct
... (* initialize sock using some extfcall *)
val sock
= sock
... (* use sock in a linear closure *)

So my question is, what exactly happens when we write the following line?

val sock = sock

I'm still not clear what's the problem. Please pardon me for not able to write the question any clearer. 

Thanks,

--
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-users+unsubscribe@googlegroups.com.
To post to this group, send email to ats-lang-users@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/a1e01519-58b3-4b97-be31-658eebee87a9%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages