Hi,
I've been reading the "Introduction to Programming in ATS" book over the
past few months, and I still have no clue as to why this program won't
compile:
fn{a:t@ype} ptr_set0 {l:addr} (pf: !a? @ l | p: ptr l, v: a): void =
!p := v
implement main0 () = let
var v: int = 5
in
( let prval pf = view@(v) in
ptr_set0(pf | addr@(v), 3) ;
// !addr@(v) := 3; // uncommenting this line causes the program to
compile. no idea why.
end ;
println!("v = ", v)
)
end
I know that pf is a linear resource, and it needs to be consumed somehow..
how do I make it happen?
If I don't touch v after the call to ptr_set0 (ie. if I remove the final
println!), the program will compile.. which also makes
no sense given what I think I know about linear resources in ATS.
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 [email protected].
To post to this group, send email to [email protected].
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/45412299-4d15-4885-acb7-b165711c4e79%40googlegroups.com.