What is the ptr_type left after freeing a linear constructed value?

17 views
Skip to first unread message

Yannick Duchêne

unread,
Jul 29, 2018, 5:37:33 PM7/29/18
to ats-lang-users
I can write this, it type‑checks:

        dataviewtype t = C of int

        fn f(c: &t >> ptr_type): void = let
              val+ @C(i) = c
              val () = free@ c
           in end

        fn f(c: &t >> ptr_type): void = let
              val+ ~C(i) = c
           in end

This is mysterious to me, I rather expected something meaning there is nothing left. I guess it has no value, or does it? May be a null `addr`? But it does not seems to be `addr` indexed like `ptr_addr_type` is

Hongwei Xi

unread,
Jul 29, 2018, 5:55:29 PM7/29/18
to ats-lan...@googlegroups.com
Currently, the type 't?' is treated as ptr_type.

Strictly speaking,
your function 'f' should have the following interface:

fn f(c: &t >> t?): void


--
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/2fee5f83-d3df-471c-a9a4-f68d23920624%40googlegroups.com.

Yannick Duchêne

unread,
Jul 29, 2018, 8:55:47 PM7/29/18
to ats-lang-users


Le dimanche 29 juillet 2018 23:55:29 UTC+2, gmhwxi a écrit :
Currently, the type 't?' is treated as ptr_type.

Strictly speaking,
your function 'f' should have the following interface:

fn f(c: &t >> t?): void

My bad, I knew `t?` but did not think about it: I get to `ptr_type` reading Postiats messages. 
Reply all
Reply to author
Forward
0 new messages