FILEREF type is non-linear?

28 views
Skip to first unread message

d4v3y_5c0n3s

unread,
Jul 11, 2021, 8:02:39 PM7/11/21
to ats-lang-users
Just a quick question: I noticed that the "FILEREF" type in ATS is non-linear.  Does this mean that I need to enable garbage collection to work with files?  Or is the value freed but hidden from the linear type system?

gmhwxi

unread,
Jul 18, 2021, 2:18:00 PM7/18/21
to ats-lang-users


FILEref is abstract; it is just FILE* in C. As it is non-linear, you
need to remember to close an opened file handle of this type.

BTW, FILEptr is linear; so the type system help you keep track of
file handles of the type FILEptr.

--Hongwei

PS: I often use FILEref first. If needed later, I can always change
it to FILEptr and the typechecker will then lead me to all the places
where subsequent changes are needed for such a change.

d4v3y_5c0n3s

unread,
Jul 22, 2021, 9:20:23 AM7/22/21
to ats-lang-users
Thanks for the help, I was curious about FILEref because I will soon need to work with files in my ATS project.  I hope AT3's development is going well! :)
Reply all
Reply to author
Forward
0 new messages